Revision: 18308
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 28, 2009 05:56 by manatlan
Initial Code
try: from Tkinter import * except: from tkinter import * #py3k class tkWindow(Toplevel): def __init__(self,name,**k): Toplevel.__init__(self,border=4,**k) self.master.withdraw() # hide real tk root self.title(name) def run(self): self.center() self.focus() self.wait_window() def focus(self): self.grab_set() self.focus_set() def center(self): self.update_idletasks() w= self["width"]!=0 and self["width"] or self.winfo_width() h= self["height"]!=0 and self["height"] or self.winfo_height() ws,hs = self.winfo_screenwidth(),self.winfo_screenheight() self.geometry('%dx%d+%d+%d' % (w, h, (ws/2) - (w/2), (hs/2) - (h/2)))
Initial URL
Initial Description
with focus() and center() methods
Initial Title
Simple tk toplevel window
Initial Tags
python
Initial Language
Python