[Tutor] tkSimpleDialog box question............
Suresh Kumar
Suresh Kumar" <suresh_vsamy@rediffmail.com
Wed Jun 18 13:02:47 2003
This is a multipart mime message
--Next_1055955681---0-203.199.83.248-6534
Content-type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<P>=0AHi,<BR>=0A<BR>=0A Anybody know how to place "tkSimp=
leDialog" at a given user defined location rather than the default one=
? I am calling "kSimpleDialog" in my application and it always di=
splay near to top-left ( say 100,100). But i want to place at center of the=
screen or somewhere else. How can i do it? My code is given below.<BR>=0A<=
BR>=0A<BR>=0Afrom Tkinter import *<BR>=0Aimport Pmw<BR>=0Aimport tkF=
ont<BR>=0Aimport tkSimpleDialog<BR>=0A<BR>=0Aclass Test:<BR>=0A<BR>=0A =
; def __init__(self,parent):<BR>=0A self.myparen=
t =3D parent<BR>=0A self.canvas =3D Canvasself.myparent=
,width=3D500,height=3D500)<BR>=0A self.canvas.bind('<=
;Button-1>', self.showDialog)<BR>=0A self.canvas.pac=
k()<BR>=0A<BR>=0A def showDialog():<BR>=0A =
radiotype =3D 0<BR>=0A RadioButtonTest.(=
sefl.myparent,"Radio Test",radiotype) <BR>=0A<BR>=0A<BR>=0Aclass =
RadioButtonTest(tkSimpleDialog.Dialog):<BR>=0A def __ini=
t__( self, parent,title, filetype) :<BR>=0A  =
; tkSimpleDialog.Dialog.__init__( self, parent, title)<BR>=0A &=
nbsp; self.group =3D IntVar()<BR>=0A =
def body(self, master):<BR>=0A &nbs=
p;fType =3D Frame(master, borderwidth=3D1, relief=3DSUNKEN)<BR>=0A &n=
bsp; first =3D Radiobutton(fType,text =3D " =
Test1", ariable=3Dself.group, value=3D1)<BR>=0A &nb=
sp; first.pack(side=3DTOP,anchor=3DW)<BR>=0A<BR>=0A &nbs=
p; second =3D Radiobutton(fType, text =3D " =
Test2", variable=3Dself.group, value=3D2)<BR>=0A &n=
bsp; second.pack(side=3DTOP, anchor=3DW)<BR>=0A &=
nbsp; first.select()<BR>=0A &n=
bsp; fType.pack(side=3D"right", padx=3D3)<BR>=0A<BR>=0A<BR>=
=0Aroot =3D Tk()<BR>=0Amytest =3D Test(root)<BR>=0Aroot.mainloop()<BR=
>=0A<BR>=0A<BR>=0A=0A</P>=0A<br><br>=0A<a href=3D"http://www.herohonda.com/=
karizma?rediffmail" target=3D"_blank"><IMG SRC=3D"http://ads.rediff.com/Rea=
lMedia/ads/adstream_nx.ads/www.rediffmail.com/inbox.htm@Bottom" border=3D0>=
</a>=0A
--Next_1055955681---0-203.199.83.248-6534
Content-type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi,=0A=0A Anybody know how to place "tkSimpleDialog" at a given user def=
ined location rather than the default one? I am calling "kSimpleDialog" in =
my application and it always display near to top-left ( say 100,100). But i=
want to place at center of the screen or somewhere else. How can i do it? =
My code is given below.=0A=0A=0Afrom Tkinter import *=0Aimport Pmw=0Aimpo=
rt tkFont=0Aimport tkSimpleDialog=0A=0Aclass Test:=0A=0A def __init__(se=
lf,parent):=0A self.myparent =3D parent=0A self.canvas =3D Canvas=
self.myparent,width=3D500,height=3D500)=0A self.canvas.bind('<Button-1=
>', self.showDialog)=0A self.canvas.pack()=0A=0A def showDialog():=
=0A radiotype =3D 0=0A RadioButtonTest.(sefl.myparent,"Radio =
Test",radiotype) =0A=0A=0Aclass RadioButtonTest(tkSimpleDialog.Dialog):=0A =
def __init__( self, parent,title, filetype) :=0A tkSimpleDialog.Dialog.__i=
nit__( self, parent, title)=0A self.group =3D IntVar()=0A def body(self, m=
aster):=0A fType =3D Frame(master, borderwidth=3D1, relief=3DSUNKEN)=0A f=
irst =3D Radiobutton(fType,text =3D " Test1", ariable=3Dself.group, value=
=3D1)=0A first.pack(side=3DTOP,anchor=3DW)=0A=0A second =3D Radiobutton(f=
Type, text =3D " Test2", variable=3Dself.group, value=3D2)=0A second.pack(=
side=3DTOP, anchor=3DW)=0A first.select()=0A fType.pack(side=3D"right", p=
adx=3D3)=0A=0A=0Aroot =3D Tk()=0Amytest =3D Test(root)=0Aroot.mainloop()=
=0A=0A=0A
--Next_1055955681---0-203.199.83.248-6534--