How to place menu on the bottom

qxyuestc at yahoo.cn qxyuestc at yahoo.cn
Sat Aug 30 06:52:45 EDT 2008


On Aug 30, 6:04 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
> qxyue... at yahoo.cn wrote:
> >         self.rootWin.config(menu=menuBar)
> > I want to place the menu on the bottom (menuFrame.pack(side=BOTTOM,
> > fill=X)). But it does not work. Why?
>
> menubars that are configured via the window menu option are rendered by
> the underlying window system.
>
> to create a stand-alone menu bar, create a frame and pack or grid it
> where you want it, then add Menubutton widgets to it, and attach your
> pulldown menus to those buttons.
>
> the following wrapper supports both menu styles; look at the "else"
> clauses in the various "if use_native_menus" statements for code samples:
>
> http://svn.effbot.org/public/stuff/sandbox/tkinter/tkMenu.py
>
> </F>

step1: I first create a widget "menuFrame" which is belong to the
rootWin
...menuFrame = Frame(self.rootWin)
step2: then I put the widget to the bottom of the rootWin
...menuFrame.pack(side=BOTTOM, fill=X)
step3: I create a menu belong to the menuFrame.
...menuBar = Menu(menuFrame, tearoff=1)
since menuFrame should be placed to the bottom, so does the menuBar in
my opinion. What the problem is?



More information about the Python-list mailing list