summaryrefslogtreecommitdiff
path: root/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
commit458120dd40db6b4df55a4e96b650e16798ef06a0 (patch)
tree8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py
parent3a742c699f6806c1145aea5149bf15de15a0afd7 (diff)
add hg and python
Diffstat (limited to 'sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py')
-rw-r--r--sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py b/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py
new file mode 100644
index 000000000..57bf13c44
--- /dev/null
+++ b/sys/src/cmd/python/Demo/tkinter/guido/newmenubardemo.py
@@ -0,0 +1,47 @@
+#! /usr/bin/env python
+
+"""Play with the new Tk 8.0 toplevel menu option."""
+
+from Tkinter import *
+
+class App:
+
+ def __init__(self, master):
+ self.master = master
+
+ self.menubar = Menu(self.master)
+
+ self.filemenu = Menu(self.menubar)
+
+ self.filemenu.add_command(label="New")
+ self.filemenu.add_command(label="Open...")
+ self.filemenu.add_command(label="Close")
+ self.filemenu.add_separator()
+ self.filemenu.add_command(label="Quit", command=self.master.quit)
+
+ self.editmenu = Menu(self.menubar)
+
+ self.editmenu.add_command(label="Cut")
+ self.editmenu.add_command(label="Copy")
+ self.editmenu.add_command(label="Paste")
+
+ self.helpmenu = Menu(self.menubar, name='help')
+
+ self.helpmenu.add_command(label="About...")
+
+ self.menubar.add_cascade(label="File", menu=self.filemenu)
+ self.menubar.add_cascade(label="Edit", menu=self.editmenu)
+ self.menubar.add_cascade(label="Help", menu=self.helpmenu)
+
+ self.top = Toplevel(menu=self.menubar)
+
+ # Rest of app goes here...
+
+def main():
+ root = Tk()
+ root.withdraw()
+ app = App(root)
+ root.mainloop()
+
+if __name__ == '__main__':
+ main()