[Tutor] What does 'Bind Return Key' do?
Mike Barnett
mike_barnett at hotmail.com
Mon Apr 29 15:55:14 EDT 2019
You'll find it discussed in a couple of places in the PySimpleGUI documentation.
For example, this was written about it under the Button Element section of the docs:
----------------------------------------------
The ENTER key :
The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window.
The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the bind_return_key parameter in the button calls.
If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right.
----------------------------------------------
When questions like this arise on PySimpleGUI, I recommend pulling up the docs and pressing Control-F to do a search.
@mike
-----Original Message-----
From: Matthew Polack <matthew.polack at htlc.vic.edu.au>
Sent: Sunday, April 28, 2019 4:49 AM
To: tutor at python.org
Subject: [Tutor] What does 'Bind Return Key' do?
Hi,
We're learning Python with PySimpleGUi and have used this example program...
https://github.com/PySimpleGUI/PySimpleGUI/blob/master/ProgrammingClassExamples/Win10%20versions/1d%20PSG%20(named%20input%20keys%20and%20catch%20errors).py
There is a mystery command that says:
[sg.ReadButton('Submit', bind_return_key = False)]]
If I change this 'Bind_Return_Key' value from False to True...or in fact delete it entirely, it appears to make do difference whatsoever to the functioning of the program that I can see...
Could someone explain what the purpose of this could be? I'm guessing it has to have a reason to be there!
Thanks!
--
**Disclaimer: *Whilst every attempt has been made to ensure that material contained in this email is free from computer viruses or other defects, the attached files are provided, and may only be used, on the basis that the user assumes all responsibility for use of the material transmitted. This email is intended only for the use of the individual or entity named above and may contain information that is confidential and privileged. If you are not the intended recipient, please note that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or telephone +61 3 5382 2529** and destroy the original message.*
More information about the Tutor
mailing list