Van Dark 1 Posted July 6, 2022 python Quote Share this post Link to post Short link Share on other sites
MoD 32 #521170 Posted July 6, 2022 Кури по сорцам как работает метод handleKeyEvent Quote Share this post Link to post Short link Share on other sites
StranikS_Scan 4,203 #521191 Posted July 6, 2022 import BigWorld, Keys from gui import InputHandler def onKeyDown(event): if event.isKeyDown() and BigWorld.isKeyDown(Keys.KEY_TAB): <твой код> InputHandler.g_instance.onKeyDown += onKeyDown 1 Quote Share this post Link to post Short link Share on other sites
Van Dark 1 #521293 Posted July 7, 2022 спасибо, работает Quote Share this post Link to post Short link Share on other sites
Kurzdor 430 #521479 Posted July 10, 2022 (edited) Как ещё вариант, хукая handleKeyEvent. import game import Keys @override(game, "handleKeyEvent") def handleKeyEvent(base, event): print event.isRepeatedEvent() # detect repeated event to prevent perfomance issues print event.isKeyDown() print event.key # code from scripts/client/Keys.py, use on key up/down event for only one key print event.key in (Keys.KEY_LALT, Keys.KEY_RALT) print BigWorld.isKeyDown(Keys.KEY_LCTRL) and BigWorld.isKeyDown(Keys.KEY_H) # check if all hotkey sequence is pressed at the moment return base(event) Вообще замечаю, что вместо подписки на ивент некоторые мододелы используют хук для этого. override функцию можно взять везде Edited July 10, 2022 by Kurzdor Quote Share this post Link to post Short link Share on other sites