麻烦大佬帮忙看一下热键的问题,想send order直接用热键,不点鼠标。不知道为什么报错。
在vnpy/trader/ui/widget的
class TradingWidget(QtWidgets.QWidget):
def send_order(self) -> None:
下面加了
keyboard.add_hotkey('z+x', send_order, suppress = False)
报错:
Traceback (most recent call last):
File "C:\veighna_studio\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\veighna_studio\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\veighna_studio\lib\site-packages\keyboard_generic.py", line 58, in process
if self.pre_process_event(event):
File "C:\veighna_studio\lib\site-packages\keyboard__init.py", line 218, in pre_process_event
callback(event)
File "C:\veighna_studio\lib\site-packages\keyboard\init__.py", line 649, in <lambda>
handler = lambda e: (event_type == KEY_DOWN and e.event_type == KEY_UP and e.scan_code in _logically_pressed_keys) or (event_type == e.event_type and callback())
TypeError: TradingWidget.send_order() missing 1 required positional argument: 'self'