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

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


--/3yNEOqWowh/8j+e
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

You might want to go to python.org and download the latest distribution
(2.2 is the current stable release).  I'm fairly certain there have been
several changes/upgrades to the Tkinter module since 1.5 was released.

Brett

On Sun, May 04, 2003 at 10:44:10PM -0700, Python-lover wrote:
> Iam using Linux7.2 which contains python1.5
>=20
> --- Brett Kelly <bkelly@sourcereview.net> wrote:
> > Any reason you're using python 1.5 instead of 2.2?
> >=20
> >=20
> > 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
> > > =20
> > > 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
> > --=20
> > Brett Kelly
> > bkelly@sourcereview.net
> >=20
> > This message was created using the Mutt mail agent
> > and=20
> > digitally signed using GnuPG.
> >=20
> >=20
>=20
> > ATTACHMENT part 2 application/pgp-signature=20
>=20
>=20
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com

--=20
Brett Kelly
bkelly@sourcereview.net

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


--/3yNEOqWowh/8j+e
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE+tfsea7gYa9SI8SoRAs5KAJsGjIJitJ1jDhPx8jMAiYQcT57sggCfYdpB
pXx2W7AOPJxk/g2w3AKj8AY=
=hDTX
-----END PGP SIGNATURE-----

--/3yNEOqWowh/8j+e--