Function calling problem

rainer2207 at my-deja.com rainer2207 at my-deja.com
Sun Aug 29 11:57:46 CEST 1999


Can someone please explain what's wrong with this code? I've tried to
call the function quit(self) but I get an error. What's wrong here?

from Tkinter import *
import sys, Dialog

class Interface:


	def __init__(self, master):

		self.menu = Menu(master, tearoff=0, name="menu")
		master.configure(menu=self.menu)

		self.frame = Frame(master, width="15c", height="10c",
bd=2, relief="sunken")
		self.frame.pack(fill="both", expand=1)

		m = Menu(self.menu, tearoff=0)
		self.menu.add_cascade(label="File", menu=m, underline=0)

		n = Menu(m, tearoff=0)
		m.add_cascade(label="New", menu=n, underline=0)
		n.add_command(label="RDF Schema", underline=4)
		n.add_command(label="RDF Metadata", underline=4)

		o = Menu(m, tearoff=0)
		m.add_cascade(label="Open", menu=n, underline=0)
		o.add_command(label="RDF Schema", underline=5)
		o.add_command(label="RDF Metadata", underline=5,
command=self.open)

		m.add_command(label="Save", underline=0)
		m.add_command(label="Save As...", underline=5)
		m.add_command(label="Close", underline=0)
		m.add_separator()
		m.add_command(label="Exit", underline=0,
command=self.quit)

		m = Menu(m, tearoff=0)
		self.menu.add_cascade(label="Edit", menu=m, underline=0)
		m.add_command(label="Cut", underline=2)
		m.add_command(label="Copy", underline=0)
		m.add_command(label="Paste", underline=0)

		m = Menu(m, tearoff=0)
		self.menu.add_cascade(label="Help", menu=m, underline=0)
		a = Menu(m, tearoff=0)
		m.add_command(label="About", underline=0)

	def quit(self):

		sys.exit(0)


root = Tk()
inter = Interface(root)
root.title("Title")
root.mainloop()


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list