The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

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!