[Tutor] tkinter issue in python 3
Peter Otten
__peter__ at web.de
Sun Aug 7 13:16:58 CEST 2011
Khalid Al-Ghamdi wrote:
> I'm studying this
> tutorial<http://www.pythonware.com/library/tkinter/introduction/hello-
again.htm>about
> tkinter, but it that it's code in a 2.X.
>
> I'm using the following code in python 3, but when i hit quite in the
> resulting widget it hangs. I've tried modifying the things I know about to
> no avail. Can anyone help?
>
> Here's my code:
>
> 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()
There is nothing suspicious in the above code.
If you are running it from within IDLE, try again from the commandline.
More information about the Tutor
mailing list