Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Tkinter "withdraw" and "askstring" problem

Reply
Thread Tools

Re: Tkinter "withdraw" and "askstring" problem

 
 
Jeff Epler
Guest
Posts: n/a
 
      04-12-2005
The answer has to do with a concept Tk calls "transient".
wm transient window ?master?
If master is specified, then the window manager is informed that
window is a transient window (e.g. pull-down menu) working on
behalf of master (where master is the path name for a top-level
window). If master is specified as an empty string then window
is marked as not being a transient window any more. Otherwise
the command returns the path name of window’s current master, or
an empty string if window isn’t currently a transient window. A
transient window will mirror state changes in the master and
inherit the state of the master when initially mapped. It is an
error to attempt to make a window a transient of itself.

In tkSimpleDialog, the dialog window is unconditionally made transient
for the master. Windows is simply following the documentation: The
askstring window "inherit[s] the state of the master [i.e., withdrawn]
when initially mapped".

The fix is to modify tkSimpleDialog.Dialog.__init__ to only make the
dialog transient for its master when the master is viewable. This
mirrors what is done in dialog.tcl in Tk itself. You can either change
tkSimpleDialog.py, or you can include a new definition of __init__ with
these lines at the top, and the rest of the function the same:
def __init__(self, parent, title = None):
''' the docstring ... '''
Toplevel.__init__(self, parent)
if parent.winfo_viewable():
self.transient(parent)
...

# Thanks for being so dynamic, Python!
tkSimpleDialog.Dialog.__init__ = __init__; del __init__

Jeff

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

iD8DBQFCW9P9Jd01MZaTXX0RAoyiAJ9LThutTzZZbI9qrTgHoc G3NjvORwCeOHPL
Y1MOgSLsXt/jzkymHZf2gUQ=
=ShII
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: What is the differences between tkinter in windows and Tkinter inthe other platform? Hidekazu IWAKI Python 0 12-15-2009 05:58 AM
What is the differences between tkinter in windows and Tkinter in theother platform? Hidekazu IWAKI Python 1 12-14-2009 03:44 PM
from Tkinter import *,win = Tk() "from Tkinter import *" Pierre Dagenais Python 0 08-03-2008 10:33 PM
Re: [Tkinter-discuss] Please help -- Tkinter Scale widget withDoubleVar is acting weird Jeff Epler Python 0 08-23-2004 02:31 PM
Re: [Tkinter-discuss] Please help -- Tkinter Scale widget withDoubleVar is acting weird Jeff Epler Python 0 08-20-2004 12:07 PM



Advertisments