Tkinter question
Ali Dada
afd00 at aub.edu.lb
Thu Apr 3 04:14:42 EST 2003
hi all:
i have a window made of a couple of buttons stacked above each other.i need to
any a widget on the top that opens a submenu to the right when clicked. how can
i do that? see the code below and tell me how to correct it (the submenu is
opening downwards over the other buttons, not to the right)
#!/usr/bin/env python
import sys
from Tkinter import *
from tkMessageBox import *
from tkSimpleDialog import askfloat
def makemenu(root):
pref = Menu(root)
root.config(menu=pref)
class Index(Frame):
def __init__(self):
Frame.__init__(self)
self.pack()
Button(self, text='Repository').pack(side=TOP, fill=BOTH)
Button(self, text='Regression').pack(side=TOP, fill=BOTH)
Button(self, text='Code Manage').pack(side=TOP, fill=BOTH)
def makemenu(self, root):
pref = Menu(root)
root.config(menu=pref)
pref1 = Menu(pref, tearoff=0)
pref1.add_command(label='Cut', underline=0)
pref1.add_command(label='Paste', underline=0)
pref.add_cascade(label='Preference >', menu=pref1, underline=0)
if __name__ == '__main__':
root=Tk()
root.title('TAGZ')
i = Index()
i.makemenu(root)
i.mainloop()
More information about the Python-list
mailing list