You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onEnterPressed is only called when pressing the Return-button. Using Enter on the numpad doesn't seem to work. I have looked for a way to bind another handler to the Enter button but could only find mvKey_Return in the list. Shouldn't mvKey_Return refer to both "Return" and "Enter" anyways? I'm pretty sure that's how it worked in the past, but I'm not sure what changed tbh.
My current workaround as suggested by v-ein on Discord: I'm using 627 as a hardcoded key code for my KeypadEnter callback.
dpg.add_key_press_handler(627, callback=onEnterPressed) # hardcode workaround for missing ImGuiKey_KeypadEnter
Here's @v-ein's comment since the explanation he gave is relevant for this issue:
v-ein — Yesterday at 22:34
For some reason DPG does not export the ImGui constant for this key (ImGuiKey_KeypadEnter) - not sure why, maybe there were portability issues... You can hardcode it yourself but this will break in a future version of DPG:
mvKey_NumPadEnter = 627 # the value obtained from key_press_handler
Alternatively, you can build your own DPG and add the corresponding constant to src/mvContext.cpp.
Or you can open an issue on GitHub and see if somebody checks if this constant leads to any unanticipated issues, and adds it if everything is fine.
Proposed solution therefore would be to either:
make ImGuiKey_KeypadEnter accessible and bind it to "mvKey_NumPadEnter"
mvKey_NumPadEnter = 627 # hardcode it and ask the gods if they intend to make this break in a horrible and insidious way
To Reproduce
Run the test script, try pressing Return and Enter
Expected behavior
Both buttons should lead to the callback function "onEnterPressed" being called
Standalone, minimal, complete and verifiable example
# Here's some code anyone can copy and paste to reproduce your issueimportdearpygui.dearpyguiasdpgdefonEnterPressed():
print ("onEnterPressed")
dpg.create_context()
dpg.create_viewport(title='Custom Title', width=600, height=300)
withdpg.handler_registry():
dpg.add_key_press_handler(dpg.mvKey_Return, callback=onEnterPressed)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
The text was updated successfully, but these errors were encountered:
Version of Dear PyGui
Version: 2.0.0
Operating System: Windows 10
My Issue/Question
onEnterPressed is only called when pressing the Return-button. Using Enter on the numpad doesn't seem to work. I have looked for a way to bind another handler to the Enter button but could only find mvKey_Return in the list. Shouldn't mvKey_Return refer to both "Return" and "Enter" anyways? I'm pretty sure that's how it worked in the past, but I'm not sure what changed tbh.
My current workaround as suggested by v-ein on Discord: I'm using 627 as a hardcoded key code for my KeypadEnter callback.
Here's @v-ein's comment since the explanation he gave is relevant for this issue:
Proposed solution therefore would be to either:
To Reproduce
Run the test script, try pressing Return and Enter
Expected behavior
Both buttons should lead to the callback function "onEnterPressed" being called
Standalone, minimal, complete and verifiable example
The text was updated successfully, but these errors were encountered: