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

Function _widget_was_created

PySimpleGUI/PySimpleGUI.py:15329–15350  ·  view source on GitHub ↗

Determines if a Widget was created. :return: True if a Widget has been created previously (Widget is not None) :rtype: (bool)

(widget)

Source from the content-addressed store, hash-verified

15327# ======================== TK CODE STARTS HERE ========================================= #
15328
15329def _widget_was_created(widget):
15330 """
15331 Determines if a Widget was created.
15332
15333 :return: True if a Widget has been created previously (Widget is not None)
15334 :rtype: (bool)
15335 """
15336 if widget is not None:
15337 return True
15338 else:
15339 if SUPPRESS_WIDGET_NOT_FINALIZED_WARNINGS:
15340 return False
15341
15342 warnings.warn('You cannot an operation on a tkinter widget is being attempted before the widget has been initialized', UserWarning)
15343 if not SUPPRESS_ERROR_POPUPS:
15344 _error_popup_with_traceback('tkinter widget not initialized error.',
15345 'You cannot perform operations (such as calling update) on an Element until:',
15346 ' window.read() is called or finalize=True when Window created.',
15347 'Adding a "finalize=True" parameter to your Window creation will likely fix this.',
15348 _create_error_message(),
15349 )
15350 return False
15351
15352
15353def _widget_set_fg_color(widget, fg_color=None):

Callers 2

_widget_set_fg_colorFunction · 0.85
_widget_set_bg_colorFunction · 0.85

Calls 2

_create_error_messageFunction · 0.85

Tested by

no test coverage detected