[Tutor] Pmw/Tkinter question
Albert-Jan Roskam
sjeik_appie at hotmail.com
Tue Mar 15 15:30:23 EDT 2016
> Date: Sun, 13 Mar 2016 19:19:55 -0500
> From: robertvstepp at gmail.com
> To: tutor at python.org
> Subject: Re: [Tutor] Pmw/Tkinter question
>
> I just cannot leave this problem alone; however, I *do* believe I have
> found the correct way to do what Albert-Jan desires within the
> publicly accessible features of Pmw and Tkinter. I looked at the Pmw
> documentation online at
>
> http://pmw.sourceforge.net/doc/OptionMenu.html
>
> and it said:
>
> <quote>
> menubutton
>
> The menu button displaying the currently selected value. By default,
> this component is a Tkinter.Menubutton.
> </quote>
>
> So I looked up Tkinter.Menubutton next in one of my books and it has
> the desired anchor option. So if we add
>
> menubutton_anchor = 'w'
>
> in the appropriate place, then I get the desired alignment. BTW, this
> fits in with Peter's suggestion. It just needs to be using the normal
> Pmw/Tkinter machinery:
Thanks, you're right! After the line:
self.vege_menu.grid(row=1, column=0, sticky = 'w', padx = 10, pady = 10)
either one of the following lines does the trick:
self.vege_menu.configure(menubutton_anchor=Tkinter.W)
#self.vege_menu.configure(menubutton_anchor=' w')
#self.vege_menu._menubutton.config(anchor=Tkinter.W)
This does not work, however:
self.vege_menu.grid(row=1, column=0, sticky = 'w', padx = 10, pady = 10, menubutton_anchor=Tkinter.W)
I tested this on debian linux jessie, with Python 2.7 (it turned out that I incorrectly compiled 3.5, no _tkinter)
Best wishes,
Albert-Jan
More information about the Tutor
mailing list