Calling Python-tk code from C/C++

bobicanprogram icanbob at gmail.com
Wed Jan 28 09:21:13 EST 2009


On Jan 27, 12:29 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Tue, 27 Jan 2009 07:42:01 -0200, Rajorshi Biswas <rajor... at in.com>
> escribió:
>
> > 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.
>
>  From the above description I don't see where PyQt is involved. Do you
> really want to mix Qt and Tk in the same application? I don't think they
> could coexist...
> --
> Gabriel Genellina


Check out the SIMPL project (http://www.icanprogram.com/simpl).
Using that toolkit you should be able to have your C++ module exchange
a message with a separate Python/Tk/SIMPL module.    This might do
what you are after.

bob



More information about the Python-list mailing list