tkSimpleDialog box question............

Suresh Kumar suresh_vsamy at rediffmail.com
Wed Jun 18 19:01:21 CEST 2003


An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030618/5e9f2b70/attachment.html>
-------------- next part --------------
Hi,

    Anybody know how to place "tkSimpleDialog" at a given user defined 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.


from   Tkinter import *
import Pmw
import tkFont
import tkSimpleDialog

class Test:

    def __init__(self,parent):
      self.myparent = parent
      self.canvas = Canvasself.myparent,width=500,height=500)
      self.canvas.bind('<Button-1>', self.showDialog)
      self.canvas.pack()

    def showDialog():
        radiotype = 0
        RadioButtonTest.(sefl.myparent,"Radio Test",radiotype) 


class RadioButtonTest(tkSimpleDialog.Dialog):
	def __init__( self, parent,title, filetype) :
		tkSimpleDialog.Dialog.__init__( self, parent, title)
		self.group = IntVar()
	def body(self, master):
		fType = Frame(master, borderwidth=1, relief=SUNKEN)
		first = Radiobutton(fType,text = " Test1", ariable=self.group, value=1)
		first.pack(side=TOP,anchor=W)

		second = Radiobutton(fType, text = " Test2", variable=self.group, value=2)
		second.pack(side=TOP, anchor=W)
		first.select()
		fType.pack(side="right", padx=3)


root = Tk()
mytest =  Test(root)
root.mainloop()




More information about the Python-list mailing list