跳到主要內容

[Python] PyQt4 真的是神! 真的是難!

延續標題,參考文件還真的很少!! 為了這廝(PyQt4) 我連580P的原文書都在嗑,吐血~~~

先檢附基本形式

# code from
import sys, time
from PyQt4.QtCore import *
from PyQt4.QtGui import *



class Form(QDialog):
    def __init__(self):
        super(Form, self).__init__(parent=None)

        dial = QDial()
        dial.setNotchesVisible(True)
        spinbox = QSpinBox()

        layout = QHBoxLayout()
        layout.addWidget(dial)
        layout.addWidget(spinbox)
        self.setLayout(layout)

        self.connect(dial, SIGNAL("valueChanged(int)"), spinbox, SLOT("setValue(int)"))
        self.connect(spinbox, SIGNAL("valueChanged(int)"), dial, SLOT("setValue(int)"))
        self.setWindowTitle("Signals and Slots")


app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()


成果:

其實蠻可愛的XD

但似乎找不太到各元件與對應的用法與外觀
之後把我覺得我會常用的列上好了

留言