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

Method set_focus

PySimpleGUI/PySimpleGUI.py:1515–1530  ·  view source on GitHub ↗

Sets the current focus to be on this element :param force: if True will call focus_force otherwise calls focus_set :type force: bool

(self, force=False)

Source from the content-addressed store, hash-verified

1513
1514
1515 def set_focus(self, force=False):
1516 """
1517 Sets the current focus to be on this element
1518
1519 :param force: if True will call focus_force otherwise calls focus_set
1520 :type force: bool
1521 """
1522 if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
1523 return
1524 try:
1525 if force:
1526 self.Widget.focus_force()
1527 else:
1528 self.Widget.focus_set()
1529 except Exception as e:
1530 _error_popup_with_traceback("Exception blocking focus. Check your element's Widget", e)
1531
1532 def block_focus(self, block=True):
1533 """

Callers 6

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
popup_get_textFunction · 0.80

Calls 2

_widget_was_createdMethod · 0.95

Tested by

no test coverage detected