我想继承MainWindow然后做一些修改,但是简单继承之后,在界面上点击“连接TtsGateway”就会报错“TypeError: PySide6.QtCore.QObject.connect(): not enough arguments”, 我研究了很久,也问过GPT和Cursor,但是依然不清楚为什么会报错,请各位大佬指点一下~
环境信息和代码如下:
环境:
requires-python = ">=3.10"
dependencies = [
"pyside6==6.3.0",
"setuptools>=75.7.0",
"tzlocal==5.2",
"PySide6==6.3.0",
"pyqtgraph==0.13.4",
"qdarkstyle==3.2.3",
"numpy==1.26.4",
"pandas==2.2.1",
"matplotlib==3.8.3",
"seaborn==0.13.2",
"ta-lib==0.4.24",
"deap==1.4.1",
"pyzmq==25.1.2",
"plotly==5.20.0",
"importlib-metadata==7.0.2",
"tqdm==4.66.2",
"vnpy==3.9.4",
"vnpy-spreadtrading>=1.2.5",
"vnpy-tts>=6.7.2.0",
"dynaconf>=3.2.6",
"loguru>=0.7.3",
]
代码
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import create_qapp
from vnpy_tts import TtsGateway
from vnpy.trader.ui import MainWindow
from vnpy_spreadtrading import SpreadTradingApp
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow
class NewMainWindow(MainWindow):
def __init__(self, main_engine, event_engine):
super().__init__(main_engine=main_engine, event_engine=event_engine)
def main():
""""""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(TtsGateway)
main_engine.add_app(SpreadTradingApp)
main_window = NewMainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ == "__main__":
main()