【发布时间】:2012-09-03 16:20:29
【问题描述】:
我需要一个来自主窗口的字符串来显示在一个对话框上,我遇到了一些问题......
这是我的代码:
class Ui_MainWindow(QtGui.QMainWindow):
drive_signal = QtCore.pyqtSignal(str)
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(459, 280)
..... #non relevant code
.....
drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1][1:]
self.drive_combo.clear()
self.drive_combo.addItems(drives)
self.drive_signal.emit(self.drive_combo.currentText())
.....
.....
class SubDialog(QtGui.QDialog):
def setupUi(self, Dialog):
Dialog.setWindowTitle(Ui_MainWindow.drive_signal.connect())
Dialog.resize(532, 285)
.....
.....
但我收到此错误:
AttributeError: 'PyQt4.QtCore.pyqtSignal' object has no attribute 'connect'
有什么帮助吗?
【问题讨论】:
标签: python pyqt pyqt4 signals-slots