[Tutor] [Q] Tkinter
Young-Jin Lee
ylee12@uiuc.edu
Wed, 31 Oct 2001 15:12:16 -0600
This is a multi-part message in MIME format.
------=_NextPart_000_0097_01C1621E.6D0F6170
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, all.
I have a question using Tkiner. Here is the sample code I used.=20
from Tkinter import *
class App:
def __init__(self, master):
frame =3D Frame(master)
frame.pack()
self.button =3D Button(frame, text=3D"QUIT", fg=3D"red", =
command=3Dframe.quit)
self.button.pack(side=3DLEFT)
self.hi_there =3D Button(frame, text=3D"Hello", =
command=3Dself.say_hi)
self.hi_there.pack(side=3DLEFT)
def say_hi(self):
print "hi there, everyone!"
root =3D Tk()
app =3D App(root)
root.mainloop()
How can I make this test application to quit instead of Python shell =
itself? When I click the quit button, the IDLE itself quits. This is not =
what I wanted. I want to close only this application. How can I do this?
Thanks.
------=_NextPart_000_0097_01C1621E.6D0F6170
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi, all.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have a question using Tkiner. Here is =
the sample=20
code I used. </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>from Tkinter import *<BR><BR>class=20
App:<BR><BR> def __init__(self,=20
master):<BR><BR> frame =3D=20
Frame(master)<BR> =20
frame.pack()<BR><BR> =
self.button =3D=20
Button(frame, text=3D"QUIT", fg=3D"red",=20
command=3Dframe.quit)<BR> =20
self.button.pack(side=3DLEFT)<BR><BR> =
=20
self.hi_there =3D Button(frame, text=3D"Hello",=20
command=3Dself.say_hi)<BR> =20
self.hi_there.pack(side=3DLEFT)<BR><BR> def=20
say_hi(self):<BR> print "hi =
there,=20
everyone!"<BR><BR>root =3D Tk()<BR><BR>app =3D=20
App(root)<BR><BR>root.mainloop()<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>How can I make this test application to =
quit=20
instead of Python shell itself? When I click the quit button, the IDLE =
itself=20
quits. This is not what I wanted. I want to close only this application. =
How can=20
I do this?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</DIV></FONT></BODY></HTML>
------=_NextPart_000_0097_01C1621E.6D0F6170--