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

Method update

PySimpleGUI/PySimpleGUI.py:4541–4587  ·  view source on GitHub ↗

Changes some of the settings for the Status Bar Element. Must call `Window.Read` or `Window.Finalize` prior Changes will not be visible in your window until you call window.read or window.refresh. If you change visibility, your element may MOVE. If you want it to remain st

(self, value=None, background_color=None, text_color=None, font=None, visible=None)

Source from the content-addressed store, hash-verified

4539 return
4540
4541 def update(self, value=None, background_color=None, text_color=None, font=None, visible=None):
4542 """
4543 Changes some of the settings for the Status Bar Element. Must call `Window.Read` or `Window.Finalize` prior
4544
4545 Changes will not be visible in your window until you call window.read or window.refresh.
4546
4547 If you change visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper"
4548 function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there
4549 when made visible.
4550
4551 :param value: new text to show
4552 :type value: (str)
4553 :param background_color: color of background
4554 :type background_color: (str)
4555 :param text_color: color of the text
4556 :type text_color: (str)
4557 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
4558 :type font: (str or (str, int[, str]) or None)
4559 :param visible: set visibility state of the element
4560 :type visible: (bool)
4561 """
4562
4563 if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
4564 return
4565
4566 if self._this_elements_window_closed():
4567 _error_popup_with_traceback('Error in StatusBar.update - The window was closed')
4568 return
4569
4570 if value is not None:
4571 self.DisplayText = value
4572 stringvar = self.TKStringVar
4573 stringvar.set(value)
4574 if background_color not in (None, COLOR_SYSTEM_DEFAULT):
4575 self.TKText.configure(background=background_color)
4576 if text_color not in (None, COLOR_SYSTEM_DEFAULT):
4577 self.TKText.configure(fg=text_color)
4578 if font is not None:
4579 self.TKText.configure(font=font)
4580 if visible is False:
4581 self._pack_forget_save_settings()
4582 # self.TKText.pack_forget()
4583 elif visible is True:
4584 self._pack_restore_settings()
4585 # self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
4586 if visible is not None:
4587 self._visible = visible
4588
4589 Update = update
4590

Callers

nothing calls this directly

Calls 6

_widget_was_createdMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected