dking (1) [Avatar] Offline
#1
I want to run a Tkinter app but _not_ freeze the python console with .mainloop(). I may want , e.g. to continue to add widgets interactively or with a script, or (most importantly) send commands via python to a custom widget that is part of the gui.

I see various apps that do this (e.g. matplotlib.plot on top of Tkinter), and an 'interactive' parameter to _tkinter.create, but that parameter is turned off in the _tkinter.create call within the Tk class constructor in Tkinter.py.

What gives? What's the right (==(hopefully) easy) way to do this?

direct replies to dking-at-nrao.edu also welcome.

Thanks.

David King
Jabapyth (9) [Avatar] Offline
#2
Re: keeping the python console alive
YES.
this is something i just figured out, a few days ago:

from Tkinter import *
from threading import Thread

root=Tk()
Thread(target=root.mainloop).start() ## DONOT put the () after mainloop
## Now do whatever you want!