from PyQt4 import QtCore, QtGui
class AnyWidget(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.initUI()
def initUI(self):
boxlay = QtGui.QHBoxLayout(self)
frame = QtGui.QFrame(self)
frame.setFrameShape(QtGui.QFrame.StyledPanel)
frame.setFrameShadow(QtGui.QFrame.Raised)
gridlay = QtGui.QGridLayout(frame)
label = QtGui.QLabel("label",frame)
gridlay.addWidget(label,0,0)
hellobutton = QtGui.QPushButton("Hello",None)
gridlay.addWidget(hellobutton,0,1)
self.connect(hellobutton, QtCore.SIGNAL("clicked()"), self._printtext)
boxlay.addWidget(frame)
def _printtext(self):
self.label.setText('was pressed')
if __name__=="__main__":
app = QtGui.QApplication(sys.argv)
aw = AnyWidget()
aw.show()
sys.exit(app.exec_())
И еще. может кто-то знает учебник по PyQt? всё что находил - кроме Hello World`а нету практически ничего..