I creating a test program for TKinter, and getting some errors :(
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 = Entry(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)
username = StringVar()
name = Entry(frame, textvariable=username)
name.pack(side=LEFT)
print name.get()
def say_hi(self):
print "hi there, everyone!"
root = Tk()
app = App(root)
root.mainloop()
Error:
Traceback (most recent call last):
File "first.py", line 24, in <module>
app = App(root)
File "first.py", line 12, in __init__
self.hi_there = Entry(frame, text="Hello", command=self.say_hi)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 2385, in __init__
Widget.__init__(self, master, 'entry', cnf, kw)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1974, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: unknown option "-command"
What's in this code?