我的问题很简单,但我对解决方案视而不见。我想做的就是打开 单击相应的菜单按钮或子部分时的简单对话框。 并且在使用新的,更新的语法进行连接时这样做。 这是一个小而短的简单代码。
from PySide.QtCore import *
from PySide.QtGui import *
import sys
import TheMainWindow
import PutnickiVozDialog
class TheApp(QMainWindow, TheMainWindow.Ui_MainWindow):
def __init__(self, parent=None):
super(TheApp,self).__init__(parent)
self.setupUi(self)
self.actionDodaj_Novi.connect(self.openNewPutnicki)
def openNewPutnicki(self):
self.putDialog = QDialog(self)
self.putUi = PutnickiVozDialog.Ui_putnickiSearchDialog()
self.putUi.setupUi(self.putDialog)
self.putDialog.show()
theApp = QApplication(sys.argv)
theWindow = TheApp()
theWindow.show()
theApp.exec_()
我按照教程完成了这些操作。但我得到以下错误报告。我不知道我错过了什么。
C:\Python34\python.exe "C:/Projects/Xml Database Project/PyCharm Workspace/TheApplication.py"
Traceback (most recent call last):
File "C:/Projects/Xml Database Project/PyCharm Workspace/TheApplication.py", line 45, in <module>
theWindow = TheApp()
File "C:/Projects/Xml Database Project/PyCharm Workspace/TheApplication.py", line 16, in __init__
self.actionDodaj_Novi.connect(self.openNewPutnicki)
TypeError: PySide.QtCore.QObject.connect(): not enough arguments
Process finished with exit code 1
如果我对这里的事情视而不见,我很抱歉。但它只是赢了工作。 提前谢谢!