Type Error when running Tkinter tutorial's hello2.py example

tlng at phileo.com.my tlng at phileo.com.my
Thu May 27 06:27:16 EDT 1999


Hi! I going through the draft Tkinter tutorial from Pythonware.com, and
I'm trying to run its hello2.py example program:-

Example: File: hello2.py

from Tkinter import *

class App:

    def _init_(self, master):
        frame = Frame(master)
        frame.pack()

        self.button = Button(frame, text="QUIT", fg="red",
                             command=frame.quit)
        self.button.pack(side=LEFT)

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
        print "Hi there, everyone!"

root = Tk()
app = App(root)
root.mainloop()

However, whenever I try to run the above program, I get the following
error message:-

  File "F:\PALRES~1\PALDIR~1\DEVELO~1\test.py", line 19, in ?
    app = App(root)
TypeError: this constructor takes no arguments

Does anybody know what's wrong?

I'm using Python ver 1.5.2 on Win 95.


--== 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