[clue-tech] WYSIWYG for Qt or Tk and PERL

dperkins at frii.com dperkins at frii.com
Wed Mar 22 12:19:32 MST 2006


> Greetings -
>
> I'm trying to build by first GUI with Perl using either Qt or Tk. My first
> shot at doing very basic using Tk with pack/grid didn't give me what I was
> looking for - not enough control of where the widgets are placed. I don't
> have the time or patience to use coordinates manually.
>

I haven't tried using Perl/Tk, but there are some similarities between it
and Ruby/Tk.

You didn't say what problems you are having, but here are a few comments.

Are you using frames?  You probably are, but if not, they help you
organize your window into manageable sections.

If you are using pack, in general, you probably don't want to mix
left/right with top/bottom placement.  You should add another frame
instead.

You don't want to mix geometry managers in a frame.  You can safely use
pack in one frame, and grid in another.

If you are having alignment problems, this can be solved in a few ways.
1. You can use width and height to adjust the widget size manually.  You
can also use padx and pady to add padding inside the widget.

2. If you are using pack, you might need to use the expand and fill
options.  You might also want to use the anchor option to position a
widget inside its allocated parcel, which lets you align buttons
vertically.  Pack also has padx, pady, ipadx and ipady options.

3. If you are using grid, you can use the sticky option to position the
widget in the grid.  There are options for spanning rows and columns, but
I don't recall the names right... probably rowspan and colspan.  There is
also a weight option that is useful when the window is resized.

4. If you are using scrollbars, pack the scrollbars before you pack text,
list, or canvas.


Have you read the Perl/Tk book?  Unfortunately, it doesn't include the
latest changes to Tk, but Practical Programming In Tcl And Tk can help
there.

_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list