MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / _FindReturnKeyBoundButton

Method _FindReturnKeyBoundButton

PySimpleGUI/PySimpleGUI.py:1237–1272  ·  view source on GitHub ↗

Searches for which Button has the flag Button.BindReturnKey set. It is called recursively when a "Container Element" is encountered. Func has to walk entire window including these "sub-forms" :param form: the Window object to search :type form: :return:

(self, form)

Source from the content-addressed store, hash-verified

1235 # self.ParentForm.TKroot.quit() # kick the users out of the mainloop
1236
1237 def _FindReturnKeyBoundButton(self, form):
1238 """
1239 Searches for which Button has the flag Button.BindReturnKey set. It is called recursively when a
1240 "Container Element" is encountered. Func has to walk entire window including these "sub-forms"
1241
1242 :param form: the Window object to search
1243 :type form:
1244 :return: Button Object if a button is found, else None
1245 :rtype: Button | None
1246 """
1247 for row in form.Rows:
1248 for element in row:
1249 if element.Type == ELEM_TYPE_BUTTON:
1250 if element.BindReturnKey:
1251 return element
1252 if element.Type == ELEM_TYPE_COLUMN:
1253 rc = self._FindReturnKeyBoundButton(element)
1254 if rc is not None:
1255 return rc
1256 if element.Type == ELEM_TYPE_FRAME:
1257 rc = self._FindReturnKeyBoundButton(element)
1258 if rc is not None:
1259 return rc
1260 if element.Type == ELEM_TYPE_TAB_GROUP:
1261 rc = self._FindReturnKeyBoundButton(element)
1262 if rc is not None:
1263 return rc
1264 if element.Type == ELEM_TYPE_TAB:
1265 rc = self._FindReturnKeyBoundButton(element)
1266 if rc is not None:
1267 return rc
1268 if element.Type == ELEM_TYPE_PANE:
1269 rc = self._FindReturnKeyBoundButton(element)
1270 if rc is not None:
1271 return rc
1272 return None
1273
1274 def _TextClickedHandler(self, event):
1275 """

Callers 1

_ReturnKeyHandlerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected