Skip to content
Advertisement

How to raise an event when Enter is pressed into an InputText in PySimpleGUI

i’m new with Python & PySimpleGUI and i don’t know how to force my application to handle the event key; this is my code:

JavaScript

My code can handle any key pressed by user except ; i haven’t found any argument for InputText similar to “bind_return_key=True” used into Button class. How can i do it? Thanks

Advertisement

Answer

Using method bind("<Return>", key_modifier) of sg.Input after window finalized, it will generate an event sg.Input().Key + key_modifier when this element focused and Enter key pressed.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement