PyROOT, Threads, GUI

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?

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


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.


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”.