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

Method update

PySimpleGUI/PySimpleGUI.py:2326–2475  ·  view source on GitHub ↗

Changes some of the settings for the Combo Element. Must call `Window.Read` or `Window.Finalize` prior. Note that the state can be in 3 states only.... enabled, disabled, readonly even though more combinations are available. The easy way to remember is that if you ch

(self, value=None, values=None, set_to_index=None, disabled=None, readonly=None, font=None, visible=None, size=(None, None), select=None, text_color=None, background_color=None)

Source from the content-addressed store, hash-verified

2324 text_color=fg, key=key, pad=pad, tooltip=tooltip, font=font or DEFAULT_FONT, visible=visible, metadata=metadata)
2325
2326 def update(self, value=None, values=None, set_to_index=None, disabled=None, readonly=None, font=None, visible=None, size=(None, None), select=None, text_color=None, background_color=None):
2327 """
2328 Changes some of the settings for the Combo Element. Must call `Window.Read` or `Window.Finalize` prior.
2329 Note that the state can be in 3 states only.... enabled, disabled, readonly even
2330 though more combinations are available. The easy way to remember is that if you
2331 change the readonly parameter then you are enabling the element.
2332
2333 Changes will not be visible in your window until you call window.read or window.refresh.
2334
2335 If you change visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper"
2336 function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there
2337 when made visible.
2338
2339 :param value: change which value is current selected based on new list of previous list of choices
2340 :type value: (Any)
2341 :param values: change list of choices
2342 :type values: List[Any]
2343 :param set_to_index: change selection to a particular choice starting with index = 0
2344 :type set_to_index: (int)
2345 :param disabled: disable or enable state of the element
2346 :type disabled: (bool)
2347 :param readonly: if True make element readonly (user cannot change any choices). Enables the element if either choice are made.
2348 :type readonly: (bool)
2349 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
2350 :type font: (str or (str, int[, str]) or None)
2351 :param visible: control visibility of element
2352 :type visible: (bool)
2353 :param size: width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list
2354 :type size: (int, int)
2355 :param select: if True, then the text will be selected, if False then selection will be cleared
2356 :type select: (bool)
2357 :param background_color: color of background
2358 :type background_color: (str)
2359 :param text_color: color of the text
2360 :type text_color: (str)
2361 """
2362 if size != (None, None):
2363 if isinstance(size, int):
2364 size = (size, 1)
2365 if isinstance(size, tuple) and len(size) == 1:
2366 size = (size[0], 1)
2367
2368 if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
2369 return
2370
2371 if self._this_elements_window_closed():
2372 _error_popup_with_traceback('Error in Combo.update - The window was closed')
2373 return
2374
2375 if values is not None:
2376 try:
2377 self.TKCombo['values'] = values
2378 # self.TKCombo.current(0) # don't set any value if a new set of values was made
2379 except:
2380 pass
2381 self.Values = values
2382 if value is None:
2383 self.TKCombo.set('')

Callers 1

DownloadSubtitlesGUIFunction · 0.95

Calls 6

_widget_was_createdMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected