PyROOT, Threads, GUI

Hello.
All python examples from tutorial are showing canvas and then exiting.
I think this problem can be solved using gApplication.Run().
But in that case python application freezes.
I tried to make separate thread for gApplication.Run() but in this case I don’t know how to interact with ROOT.
Is there a way to make python application (for example with PyGTK) which can interact with some ROOT instance and let the user work with application’s GUI and ROOT canvases?
Thanks.

OK. I can answer now myself :slight_smile:
To have PyGTK + PyROOT running together you should just call gtk.threads_init() before gtk.main().

Hi,

you appear to be doing something more than just running the examples. Just for completeness, however, if you want to get a prompt after the example has run to completion, the simple solution is:

$ python -i tutorials/.py

The ‘-i’ option does the trick.

Cheers,
Wim

Thanks.
In my case program just creates and draws histograms (on TCanvas) after some GUI events. And ROOT widnow didn’t react to events because of GTK. I thought that I should create separate thread for ROOT in which I shoud call TApplication->Run() and that worked when I used os.fork() and imported PyROOT for every new proccess but that is very “dirty”.