[Tutor] Pmw/Tkinter question
boB Stepp
robertvstepp at gmail.com
Sat Mar 12 22:27:31 EST 2016
On Sat, Mar 12, 2016 at 2:17 AM, Albert-Jan Roskam
<sjeik_appie at hotmail.com> wrote:
> Below is a slightly modified example about Pmw/Tkinter from http://pmw.sourceforge.net/doc/howtouse.html.
> I changed the geometry manager from 'pack' to 'grid', because I use that in all other parts of my program.
> The problem is, 'broccoli' won't display nicely under vege_menu. I want it to left-align, not center...
I cracked my copy of Grayson and went to his example for OptionMenu
widget. His example from page 64-65 is:
var = StringVar()
var.set('Quantity Surveyor')
opt_menu = Pmw.OptionMenu(root, labelpos=W,
label_text='Choose profession:', menubutton_textvariable=var,
items=('Stockbroker', 'Quantity Surveyor', 'Church Warden', 'BRM'),
menubutton_width=16)
opt_menu.pack(anchor=W, padx=20, pady=30)
In your case you use a lowercase 'w', where Grayson uses uppercase for
labelpos. I have not tried this out, but is it possible correct case
matters here? On page 584 for the labelpos option he gives:
<quote>
Option: labelpos; Units: anchor; Default: None
Specifies where to place the label component. If not None, it should
be a concatenation of one or two of the letters N, S, E and W. The
first letter specifies on which side of the megawidget to place the
label. If a second letter is specified, it indicates where on that
side to place the label. For example, if labelpos is W, the label is
placed in the center of the left-hand side; if it is WN, the label is
placed at the top of the left-hand side; if it is WS, the label is
placed at the bottom of the left-hand side.
</quote>
I presume the second letter possibilities are referring to vertical spacing.
Hope this helps!
boB
More information about the Tutor
mailing list