Albert-Jan Roskam wrote: > Hello, > > 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 don't case that it's truncated). In > plain Tkinter I could do "self.vege_menu.configure(anchor=Tkinter.W)" but > this raises a KeyError in Pmw.
I don't see an official way to to change the alignment, but looking into the source there's class OptionMenu(Pmw.MegaWidget): def __init__(self, parent = None, **kw): [...] self._menubutton = self.createcomponent('menubutton', (), None, Tkinter.Menubutton, (interior,), borderwidth = 2, indicatoron = 1, relief = 'raised', anchor = 'c', highlightthickness = 2, direction = 'flush', takefocus = 1, ) so if you don't mind touching _private attributes > self.vege_menu = Pmw.OptionMenu (parent, > labelpos = 'w', > label_text = 'Choose vegetable:', > items = ('broccoli-broccoli-broccoli-broccoli', 'peas', > 'carrots', 'pumpkin'), menubutton_width = 10, > command = self._printOrder, > ) self.vege_menu._menubutton.config(anchor=Tkinter.W) > #self.vege_menu.pack(anchor = 'w', padx = 10, pady = 10) > self.vege_menu.grid(row=1, column=0, sticky = 'w', padx = 10, pady > = 10) should work. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor