Fine, Valeri
2007-01-11 16:31:08 UTC
Hello Luca,
I am not fluent with Python, sorry. Probably you (or some one from the
roottalk) will need to explain me some basic things about Python and
Python ROOT.
By this reason my first question is, "Does your code work if you remove
the line
self.Canvas = QWidget(self.CentralWidget);
?
My guess it does work. I did pay an attention to the line
I did see the Python is aware about TQtWidget as well. However it is
confused with the ctor parameter QWidget.
I do not know how one can "explain" python that this parameter is very
pointer to the QWidget class the python is aware about via
knowledge is not enough to pinpoint the reason.
May be the only thing you need to do is to build the "qtcint" RootCint
dictionary for the Qt classes
http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html. However, I am
not sure whether it makes sense for you. It may add the insult to injury
;)
I hope some Python people on list can clarify the issue.
Best Regards
Valeri Fine
---------------
Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax: +1 631 344 4206
Hi Valeri,
I apologize for not writing on the root talk forum, but I just
registered and it seems like
I am forwarding your message to the ROOTTalk and RootDev listsI apologize for not writing on the root talk forum, but I just
registered and it seems like
I am not fluent with Python, sorry. Probably you (or some one from the
roottalk) will need to explain me some basic things about Python and
Python ROOT.
From the first glance your trouble is not caused by QtRoot class like
TQtWidget rather by the "pure" Qt class which is QWidget.By this reason my first question is, "Does your code work if you remove
the line
self.Canvas = TQtWidget(self.CentralWidget)
and replace it with the "pure" Qt class likeself.Canvas = QWidget(self.CentralWidget);
?
My guess it does work. I did pay an attention to the line
self.CentralWidget = QWidget()
that your python did not complain about.I did see the Python is aware about TQtWidget as well. However it is
confused with the ctor parameter QWidget.
I do not know how one can "explain" python that this parameter is very
pointer to the QWidget class the python is aware about via
from qt import *
I.e. I did see some confusion with the different dictionaries however myknowledge is not enough to pinpoint the reason.
May be the only thing you need to do is to build the "qtcint" RootCint
dictionary for the Qt classes
http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html. However, I am
not sure whether it makes sense for you. It may add the insult to injury
;)
I hope some Python people on list can clarify the issue.
Best Regards
Valeri Fine
---------------
Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax: +1 631 344 4206
-----Original Message-----
Sent: Thursday, January 11, 2007 10:32 AM
To: Fine, Valeri
Subject: PyQt and PyROOT
Hi Valeri,
I apologize for not writing on the root talk forum, but I just
registered and it seems like
it takes some time for my account to be activated.
We are trying to put a ROOT canvas on a qt gui and we would like to be
able to do that from
python with pyROOT and pyQt (ROOT 5.14.00, qt 3.3.3, pyQt 3.17, python
2.5).
Based on the c++ examples, we tried the following
import sys
from qt import *
from ROOT import *
QMainWindow.__init__(self)
self.CentralWidget = QWidget()
self.setCentralWidget(self.CentralWidget)
self.Layout = QGridLayout(self.CentralWidget)
self.Canvas = TQtWidget(self.CentralWidget)
self.Layout.addWidget(self.Canvas, 0, 0)
application = QApplication(sys.argv)
w = window()
w.show()
application.exec_loop()
Warning in <TClass::TClass>: no dictionary for class QWidget is
availableSent: Thursday, January 11, 2007 10:32 AM
To: Fine, Valeri
Subject: PyQt and PyROOT
Hi Valeri,
I apologize for not writing on the root talk forum, but I just
registered and it seems like
it takes some time for my account to be activated.
We are trying to put a ROOT canvas on a qt gui and we would like to be
able to do that from
python with pyROOT and pyQt (ROOT 5.14.00, qt 3.3.3, pyQt 3.17, python
2.5).
Based on the c++ examples, we tried the following
import sys
from qt import *
from ROOT import *
QMainWindow.__init__(self)
self.CentralWidget = QWidget()
self.setCentralWidget(self.CentralWidget)
self.Layout = QGridLayout(self.CentralWidget)
self.Canvas = TQtWidget(self.CentralWidget)
self.Layout.addWidget(self.Canvas, 0, 0)
application = QApplication(sys.argv)
w = window()
w.show()
application.exec_loop()
Warning in <TClass::TClass>: no dictionary for class QWidget is
File "window.py", line 18, in <module>
w = window()
File "window.py", line 12, in __init__
self.Canvas = TQtWidget(self.CentralWidget)
TypeError: TQtWidget::TQtWidget(QWidget* parent = 0) =>
could not convert argument 1
Any suggestion you can give me?
Thanks a lot,
Luca Baldini, INFN Pisa
w = window()
File "window.py", line 12, in __init__
self.Canvas = TQtWidget(self.CentralWidget)
TypeError: TQtWidget::TQtWidget(QWidget* parent = 0) =>
could not convert argument 1
Any suggestion you can give me?
Thanks a lot,
Luca Baldini, INFN Pisa