Calling Python-tk code from C/C++

Rajorshi Biswas rajorshi at
Tue Jan 27 10:42:01 CET 2009

Hello all, This is my first post to this mailing list. Our requirement is to invoke a Tkinter python panel from a C++ GUI app where both GUI windows would run in 2 separate threads. We have written a sample PyQt application which calls this Tk panel using something like this:class TkPanel(threading.Thread):def run(self): # call showPaneldef showPanel():# create window = Tk.Tk() window.mainloop()def start():t = TkPanel()t.start()Now we call this from our main python code:def startPanel(self): import tkPanel tkPanel.start() # this calls tkwindow.mainloop() in a separate thread.This works absolutely fine when the invoking app is Python. However, we are having problems when the invoking app is in C/C++ and we use a similar logic.My question boils down to this: If I have code in C++ that has to invoke a Pythontk panel such that the panel runs in its own thread, what is the best approach?I tried studying the GIL and acquiring releasing/locks, but I must be doing something wrong. An
 y help would be greatly appreciated!Thanks!Raj pythonlist! Get Yourself a cool, short Email ID now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list