[问题] pyqt4 manubar问题

楼主: noshare (zzz...)   2017-08-27 11:33:58
因为是python新手
想做一个manubar,功能是先点选下拉的数字后
再按下trigger的按钮后可以连结到for回圈的变量a
ex:选择1时,a=2 ; 选择5时,a=5
想请问一下应该怎么修改才是正确的语法?
self.button_test = QPushButton()
self.button_test.setText("trigger")
self.button_test.clicked.connect(self.content)
self.combo = QComboBox()
self.combo.addItem("2")
self.combo.addItem("5")
self.combo.addItem("10")
self.combo.activated[str].connect(self.content)
def content(self):
a = int (self.combo.text())
for i in range(1,a):
...

Links booklink

Contact Us: admin [ a t ] ucptt.com