Qt example.
3 from PyQt4.QtGui
import *
4 from PyQt4.QtCore
import *
10 class window(QMainWindow):
13 QMainWindow.__init__(self)
17 self.CentralWidget = QWidget(self)
18 self.setCentralWidget(self.CentralWidget)
19 self.Layout = QGridLayout(self.CentralWidget)
22 self.QuitButton = QPushButton(self.centralWidget())
23 self.QuitButton.setText(
'Quit')
24 self.Layout.addWidget(self.QuitButton, 1, 0)
26 QObject.connect(self.QuitButton, SIGNAL(
'clicked()'), self.quit)
29 self.hist = ROOT.TH1F(
"pipo",
"pipo", 100, 0, 100)
32 self.Address = sip.unwrapinstance(self.CentralWidget)
33 self.Canvas = ROOT.TQtWidget(sip.voidptr(self.Address).ascobject())
34 ROOT.SetOwnership( self.Canvas,
False )
38 self.Layout.addWidget(sip.wrapinstance(ROOT.AddressOf(self.Canvas)[0],QWidget), 0, 0)
44 ROOT.gApplication.Terminate()
47 if __name__ ==
'__main__':
49 terminator = ROOT.TQtRootSlot.CintSlot()
50 termAddress = sip.wrapinstance(ROOT.AddressOf(terminator)[0],QObject)
51 QObject.connect(application, SIGNAL(
"lastWindowClosed()"),termAddress ,SLOT(
"Terminate()"))
54 ROOT.gApplication.Run(1)
- Author
- Wim Lavrijsen
Definition in file qtexample.py.