NEED HELP
mailme.grover at gmail.com
mailme.grover at gmail.com
Mon Aug 28 22:22:50 EDT 2006
Below is my code, which is kind of virtual and with its help ill use it
in my main project.
Now what i am looking for is can anybody write all the code inside a
class...so that I can reuse it. I am kind of novice...n kind of stuc
with that.
from Tkinter import *
root = Tk()
w = Label(root, text="Right-click to display menu", width=40,
height=20)
w.pack()
# create a menu
popup = Menu(root, tearoff=0)
popup.add_radiobutton(label="SourceIP", command= hello) # ,
command=next) etc...
popup.add_radiobutton(label="DestIP", command= hello)
popup.add_radiobutton(label="Reporter'sIP", command= hello)
popup.add_radiobutton(label="Observer'sIP", command= hello)
popup.add_separator()
popup.add_radiobutton(label="Home")
def do_popup(event):
# display the popup menu
try:
popup.post(event.x_root, event.y_root)
finally:
# make sure to release the grab (Tk 8.0a1 only)
popup.grab_release()
def hello(event= None):
print "hello"
w.bind("<Button-3>", do_popup)
b = Button(root, text="Quit", command=root.destroy)
b.pack()
mainloop()
THANKS A LOT
More information about the Python-list
mailing list