Using Tkinter with Python embedded?
jfromm at jasc.com
Fri Apr 4 00:06:06 CEST 2003
I have an app on Windows that uses Python as a scripting language. We have
both extended and embedded Python 2.2 in our application.
We can successfully use Tkinter in a script, but the problem is that windows
created by Tk very easily get sent behind the app. What I am looking for is
a way to make a Tk window be a child of our application, so that it is not
allowed to go behind the application. I could make it topmost easily
enough, but then it won't go behind any window. Ideally I would make the Tk
window behave like a modal dialog, so that no interaction with the app is
possible until the dialog is dismissed.
I have tried getting the window handle with root.winfo_id, and then passing
that into the app and calling SetParent, but that didn't work.
I have tried creating a Toplevel widget with the use= option, passing in
window handles of either my app window or the handle of a dialog window. No
joy there either, though possibly I gave up before I explored all the
I can't believe I'm the first person to have this problem, but a number of
google searches have come up dry.
Can anyone suggest an approach?
More information about the Python-list