Hi,
I’m trying to run the ROOT example qtexample.py, as I’m trying to build a GUI using PyQT to display ROOT histograms. I have compiled ROOT to include both PyROOT and PyQt, and have successfully run some code using each of these individually.
When I try to run qtexample.py however (which is the only example I can find that shows displaying a ROOT canvas in a PyQT GUI, either within ROOT or online), I get an error as follows:
Traceback (most recent call last):
File "qtexample.py", line 51, in <module>
QObject.connect(application, SIGNAL("lastWindowClosed()"),termAddress ,SLOT("Terminate()"))
RuntimeError: underlying C/C++ object has been deleted
I hav solved this by replacing:
with:
However, I then get a segmentation violation followed by this message:
Traceback (most recent call last):
File "qtexample.py", line 52, in <module>
w = window()
File "qtexample.py", line 32, in __init__
self.Canvas = ROOT.TQtWidget(sip.voidptr(self.Address).ascobject())
SystemError: problem in C++; program state has been reset
I have traced this issue to the PyROOT::TMethodHolder< T, M >::CallSafe function, which seems to be catching an underlying C++ exception, but I have not be able to get any further with this issue.
Note that I am using ROOT v5.34.14 and Qt 4.6.2 on Scientific Linux CERN SLC release 6.5 (Carbon). I have tried also on an ubuntu machine with the same result.
Can anyone help with this problem? Is ther an issue with my ROOT installation or general environment, or is there a problem with the example?
Additionally, if anyone knows of any other examples of displaying a ROOT canvas in a PyQt GUI then it would be very helpful!
Many thanks,
Tom