How to place menu on the bottom
#!/usr/bin/env python import sys import os from tkinter import * def callback(self): #int this snippet, all menu entries use the same callback... print("callback") class DemoMenu(): def __init__(self): self.dataTemp = "" self.createWidgets() def createWidgets(self): # create application GUI self.rootWin = Tk() self.rootWin.minsize(width=800, height=600) self.rootWin.maxsize(width=800, height=600) self.rootWin.title = ("JoeQ Menu test...") self.mainFrame = Frame(self.rootWin) self.createMenu() def createMenu(self): # create menu menuFrame = Frame(self.rootWin) menuFrame.pack(side=BOTTOM, fill=X) menuBar = Menu(menuFrame, tearoff=1) filemenu = Menu(menuBar, tearoff=0) filemenu.add_command(label="Open...", command=callback) filemenu.add_separator() filemenu.add_command(label="Exit", command=callback) menuBar.add_cascade(label="File", menu=filemenu) self.rootWin.config(menu=menuBar) return menuBar def start(self): self.rootWin.mainloop() if __name__ == '__main__': demomenu = DemoMenu() demomenu.start() ## I want to place the menu on the bottom (menuFrame.pack(side=BOTTOM, fill=X)). But it does not work. Why? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to place menu on the bottom
On Aug 30, 6:04 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] 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 > > 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? -- http://mail.python.org/mailman/listinfo/python-list
what's the difference between f(a) and f(*a)
def sum1(*a): return(sum(i*i for i in a)) def sum2(a): return(sum(i*i for i in a)) a=[1,2,3] print(sum1(*a), sum2(a)) showed above: the result from sum1() and sum2() is the same. So, what is the difference between f(a) and f(*a) -- http://mail.python.org/mailman/listinfo/python-list