[Tutor] Dialogbox issues............................

Brett Kelly bkelly@sourcereview.net
Mon May 5 01:28:02 2003


--nVMJ2NtxeReIH9PS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Any reason you're using python 1.5 instead of 2.2?


On Sun, May 04, 2003 at 10:10:52PM -0700, Python-lover wrote:
> hi,
>     I am using python1.5 and Tkinter. I want to
> display the dialog box when i click the button in my
> main window. I used tkSimpleDialogBox class. But the
> following program is not working as it is expected.
> How can i diaplay a dialog box in Tkinter?  Let me
> know where i gone wrong.
>=20
> =09
> from Tkinter import *
> import tkMessageBox
> import tkSimpleDialog
> import string
>=20
> class App:
> 	def __init__(self,parent):
> 		self.myparent =3D parent
> 	Button(self.myparent,text=3D"Click",width=3D10,
> height=3D10,command=3Dself.showdlg).pack()
>=20
> 	def showdlg(self):
> 		MyDialog(self)
>=20
> #Dialogbox class
> class MyDialog(tkSimpleDialog.Dialog):
>=20
>     def body(self, master):
>         Label(master, text=3D"First:").grid(row=3D0)
>         Label(master, text=3D"Second:").grid(row=3D1)
>         self.e1 =3D Entry(master)
>         self.e2 =3D Entry(master)
>         self.e1.grid(row=3D0, column=3D1)
>         self.e2.grid(row=3D1, column=3D1)
> 	self.e1.insert(0,"suressh")
> 	self.e2.insert(0,1234)
>=20
>     def validate(self):
>         try:
>             first=3D (self.e1.get())
>             second =3D string.atoi(self.e2.get())
>             self.result =3D first, second
>             return 1
>         except ValueError:
>             tkMessageBox.showwarning("Bad input",
> "Illegal values, please try again")
>             return 0
>=20
>     def apply(self):
>         first =3D (self.e1.get())
>         second =3D string.atoi(self.e2.get())
>         print first, second
>=20
> root =3D Tk()
> myapp =3D  App(root)
> root.mainloop()
>=20
> Thanx
>=20
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
>=20
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

--=20
Brett Kelly
bkelly@sourcereview.net

This message was created using the Mutt mail agent and=20
digitally signed using GnuPG.


--nVMJ2NtxeReIH9PS
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+tfYra7gYa9SI8SoRAgvyAKCYyvkG4Qxg0T20owhHE9bZYDl7ygCfSnDg
mmMuwOqVw5YNIsYmYavU2dQ=
=V+I5
-----END PGP SIGNATURE-----

--nVMJ2NtxeReIH9PS--