'modal dialogs' with Tkinter

2005-02-22 Thread Sean McIlroy
I'd like to have a function f such that, when f is invoked, a Tk
window w is presented in which a number of variables can be modified,
and f returns the values that are indicated by the relevant
menus/checkbuttons/etc at the time w gets closed. I've tried various
ways of doing this, without success. Any assistance would be greatly
appreciated.

Peace,
Sean McIlroy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 'modal dialogs' with Tkinter

2005-02-22 Thread Eric Brunel
On 22 Feb 2005 06:03:14 -0800, Sean McIlroy [EMAIL PROTECTED] wrote:
I'd like to have a function f such that, when f is invoked, a Tk
window w is presented in which a number of variables can be modified,
and f returns the values that are indicated by the relevant
menus/checkbuttons/etc at the time w gets closed. I've tried various
ways of doing this, without success. Any assistance would be greatly
appreciated.
Here are the necessary ritual incantations to create a modal dialog with 
Tkinter:
dlg = Toplevel()
# ... build the window ...
## Set the focus on dialog window (needed on Windows)
dlg.focus_set()
## Make sure events only go to our dialog
dlg.grab_set()
## Make sure dialog stays on top of its parent window (if needed)
dlg.transient(parentWdw)
## Display the window and wait for it to close
dlg.wait_window(dlg)
The callbacks for your OK, Cancel or whatever buttons you want to use 
should then call dlg.destroy(). This will terminate the wait_window call and continue the execution 
of the code after it.
HTH
 - Eric Brunel -
--
http://mail.python.org/mailman/listinfo/python-list


Re: 'modal dialogs' with Tkinter

2005-02-22 Thread Fredrik Lundh
Sean McIlroy wrote:

 I'd like to have a function f such that, when f is invoked, a Tk
 window w is presented in which a number of variables can be modified,
 and f returns the values that are indicated by the relevant
 menus/checkbuttons/etc at the time w gets closed. I've tried various
 ways of doing this, without success. Any assistance would be greatly
 appreciated.

does the approach described here work for you?

http://www.pythonware.com/library/tkinter/introduction/dialog-windows.htm

(note that the tkSimpleDialog module is included in Python's standard library)

if it doesn't work, what doesn't work as required/expected?

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 'modal dialogs' with Tkinter

2005-02-22 Thread Birdman
You could try using: EasyGUIhttp://www.ferg.org/easygui/

 EasyGUI is different from other GUIs in that EasyGUI is NOT
event-driven. It allows you to program in a traditional linear fashion,
and to put up dialogs for simple input and output when you need to. If
you have not yet learned the event-driven paradigm for GUI programming,
EasyGUI will allow you to be productive with very basic tasks
immediately. Later, if you wish to make the transition to an
event-driven GUI paradigm, you can do so with a more powerful GUI
package such as anygui, PythonCard, Tkinter, wxPython, etc.

It works for me and is easy to modify to your needs.

-- 
http://mail.python.org/mailman/listinfo/python-list