commit
2a84d92488
309
PySimpleGUI.py
309
PySimpleGUI.py
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
version = __version__ = "4.55.1.4 Unreleased"
|
||||
version = __version__ = "4.55.1.6 Unreleased"
|
||||
|
||||
_change_log = """
|
||||
Changelog since 4.55.1 released to PyPI on 7-Nov-2021
|
||||
|
@ -15,6 +15,11 @@ _change_log = """
|
|||
Better error reporting when a problem with the layout detected
|
||||
4.55.1.4
|
||||
Removed import of site and now get the information from os.path.dirname(sys.executable). I like simpler!
|
||||
4.55.1.5
|
||||
Combo - added parameters to control the colors on the button used to display the items. Parms are button_background_color and button_arrow_color
|
||||
Default values continue to be the same the theme's button color if nothing is set.
|
||||
4.55.1.6
|
||||
Fixed missing docstring item for Table value so that the new documentation will be accurate
|
||||
"""
|
||||
|
||||
__version__ = version.split()[0] # For PEP 396 and PEP 345
|
||||
|
@ -1764,54 +1769,59 @@ class Combo(Element):
|
|||
ComboBox Element - A combination of a single-line input and a drop-down menu. User can type in their own value or choose from list.
|
||||
"""
|
||||
|
||||
def __init__(self, values, default_value=None, size=(None, None), s=(None, None), auto_size_text=None, background_color=None,
|
||||
text_color=None, bind_return_key=False, change_submits=False, enable_events=False, disabled=False, key=None, k=None, pad=None, p=None, expand_x=False, expand_y=False,
|
||||
tooltip=None, readonly=False, font=None, visible=True, metadata=None):
|
||||
def __init__(self, values, default_value=None, size=(None, None), s=(None, None), auto_size_text=None, background_color=None, text_color=None, button_background_color=None, button_arrow_color=None, bind_return_key=False, change_submits=False, enable_events=False, disabled=False, key=None, k=None, pad=None, p=None, expand_x=False, expand_y=False, tooltip=None, readonly=False, font=None, visible=True, metadata=None):
|
||||
"""
|
||||
:param values: values to choose. While displayed as text, the items returned are what the caller supplied, not text
|
||||
:type values: List[Any] or Tuple[Any]
|
||||
:param default_value: Choice to be displayed as initial value. Must match one of values variable contents
|
||||
:type default_value: (Any)
|
||||
:param size: width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int
|
||||
:type size: (int, int) | (None, None) | int
|
||||
:param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used
|
||||
:type s: (int, int) | (None, None) | int
|
||||
:param auto_size_text: True if element should be the same size as the contents
|
||||
:type auto_size_text: (bool)
|
||||
:param background_color: color of background
|
||||
:type background_color: (str)
|
||||
:param text_color: color of the text
|
||||
:type text_color: (str)
|
||||
:param bind_return_key: If True, then the return key will cause a the Combo to generate an event
|
||||
:type bind_return_key: (bool)
|
||||
:param change_submits: DEPRICATED DO NOT USE. Use `enable_events` instead
|
||||
:type change_submits: (bool)
|
||||
:param enable_events: Turns on the element specific events. Combo event is when a choice is made
|
||||
:type enable_events: (bool)
|
||||
:param disabled: set disable state for element
|
||||
:type disabled: (bool)
|
||||
:param key: Used with window.find_element and with return values to uniquely identify this element
|
||||
:type key: str | int | tuple | object
|
||||
:param k: Same as the Key. You can use either k or key. Which ever is set will be used.
|
||||
:type k: str | int | tuple | object
|
||||
:param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
|
||||
:type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
||||
:param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
|
||||
:type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
||||
:param expand_x: If True the element will automatically expand in the X direction to fill available space
|
||||
:type expand_x: (bool)
|
||||
:param expand_y: If True the element will automatically expand in the Y direction to fill available space
|
||||
:type expand_y: (bool) :param tooltip: text that will appear when mouse hovers over this element
|
||||
:type tooltip: (str)
|
||||
:param readonly: make element readonly (user can't change). True means user cannot change
|
||||
:type readonly: (bool)
|
||||
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
|
||||
:type font: (str or (str, int[, str]) or None)
|
||||
:param visible: set visibility state of the element
|
||||
:type visible: (bool)
|
||||
:param metadata: User metadata that can be set to ANYTHING
|
||||
:type metadata: (Any)
|
||||
:param values: values to choose. While displayed as text, the items returned are what the caller supplied, not text
|
||||
:type values: List[Any] or Tuple[Any]
|
||||
:param default_value: Choice to be displayed as initial value. Must match one of values variable contents
|
||||
:type default_value: (Any)
|
||||
:param size: width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int
|
||||
:type size: (int, int) | (None, None) | int
|
||||
:param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used
|
||||
:type s: (int, int) | (None, None) | int
|
||||
:param auto_size_text: True if element should be the same size as the contents
|
||||
:type auto_size_text: (bool)
|
||||
:param background_color: color of background
|
||||
:type background_color: (str)
|
||||
:param text_color: color of the text
|
||||
:type text_color: (str)
|
||||
:param button_background_color: The color of the background of the button on the combo box
|
||||
:type button_background_color: (str)
|
||||
:param button_arrow_color: The color of the arrow on the button on the combo box
|
||||
:type button_arrow_color: (str)
|
||||
:param bind_return_key: If True, then the return key will cause a the Combo to generate an event
|
||||
:type bind_return_key: (bool)
|
||||
:param change_submits: DEPRICATED DO NOT USE. Use `enable_events` instead
|
||||
:type change_submits: (bool)
|
||||
:param enable_events: Turns on the element specific events. Combo event is when a choice is made
|
||||
:type enable_events: (bool)
|
||||
:param disabled: set disable state for element
|
||||
:type disabled: (bool)
|
||||
:param key: Used with window.find_element and with return values to uniquely identify this element
|
||||
:type key: str | int | tuple | object
|
||||
:param k: Same as the Key. You can use either k or key. Which ever is set will be used.
|
||||
:type k: str | int | tuple | object
|
||||
:param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
|
||||
:type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
||||
:param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
|
||||
:type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
||||
:param expand_x: If True the element will automatically expand in the X direction to fill available space
|
||||
:type expand_x: (bool)
|
||||
:param expand_y: If True the element will automatically expand in the Y direction to fill available space
|
||||
:type expand_y: (bool)
|
||||
:param tooltip: text that will appear when mouse hovers over this element
|
||||
:type tooltip: (str)
|
||||
:param readonly: make element readonly (user can't change). True means user cannot change
|
||||
:type readonly: (bool)
|
||||
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
|
||||
:type font: (str or (str, int[, str]) or None)
|
||||
:param visible: set visibility state of the element
|
||||
:type visible: (bool)
|
||||
:param metadata: User metadata that can be set to ANYTHING
|
||||
:type metadata: (Any)
|
||||
"""
|
||||
|
||||
|
||||
self.Values = values
|
||||
self.DefaultValue = default_value
|
||||
self.ChangeSubmits = change_submits or enable_events
|
||||
|
@ -1826,6 +1836,15 @@ class Combo(Element):
|
|||
pad = pad if pad is not None else p
|
||||
self.expand_x = expand_x
|
||||
self.expand_y = expand_y
|
||||
if button_background_color is None:
|
||||
self.button_background_color = theme_button_color()[1]
|
||||
else:
|
||||
self.button_background_color = button_background_color
|
||||
if button_arrow_color is None:
|
||||
self.button_arrow_color = theme_button_color()[0]
|
||||
else:
|
||||
self.button_arrow_color = button_arrow_color
|
||||
|
||||
|
||||
super().__init__(ELEM_TYPE_INPUT_COMBO, size=sz, auto_size_text=auto_size_text, background_color=bg,
|
||||
text_color=fg, key=key, pad=pad, tooltip=tooltip, font=font or DEFAULT_FONT, visible=visible, metadata=metadata)
|
||||
|
@ -2010,6 +2029,7 @@ class OptionMenu(Element):
|
|||
self.expand_x = expand_x
|
||||
self.expand_y = expand_y
|
||||
|
||||
|
||||
super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, size=sz, auto_size_text=auto_size_text, background_color=bg,
|
||||
text_color=fg, key=key, pad=pad, tooltip=tooltip, visible=visible, metadata=metadata)
|
||||
|
||||
|
@ -3422,6 +3442,111 @@ class Text(Element):
|
|||
print('Error retrieving font information', e)
|
||||
return size
|
||||
|
||||
def _print_to_element(self, *args, end=None, sep=None, text_color=None, background_color=None, autoscroll=None, justification=None, font=None, append=None):
|
||||
"""
|
||||
Print like Python normally prints except route the output to a multiline element and also add colors if desired
|
||||
|
||||
:param multiline_element: The multiline element to be output to
|
||||
:type multiline_element: (Multiline)
|
||||
:param args: The arguments to print
|
||||
:type args: List[Any]
|
||||
:param end: The end char to use just like print uses
|
||||
:type end: (str)
|
||||
:param sep: The separation character like print uses
|
||||
:type sep: (str)
|
||||
:param text_color: color of the text
|
||||
:type text_color: (str)
|
||||
:param background_color: The background color of the line
|
||||
:type background_color: (str)
|
||||
:param autoscroll: If True (the default), the element will scroll to bottom after updating
|
||||
:type autoscroll: (bool)
|
||||
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike for the value being updated
|
||||
:type font: str | (str, int)
|
||||
"""
|
||||
end_str = str(end) if end is not None else '\n'
|
||||
sep_str = str(sep) if sep is not None else ' '
|
||||
|
||||
outstring = ''
|
||||
num_args = len(args)
|
||||
for i, arg in enumerate(args):
|
||||
outstring += str(arg)
|
||||
if i != num_args - 1:
|
||||
outstring += sep_str
|
||||
outstring += end_str
|
||||
if append:
|
||||
outstring = self.get() + outstring
|
||||
|
||||
self.update(outstring, text_color=text_color, background_color=background_color, font=font)
|
||||
|
||||
try: # if the element is set to autorefresh, then refresh the parent window
|
||||
if self.AutoRefresh:
|
||||
self.ParentForm.refresh()
|
||||
except:
|
||||
pass
|
||||
|
||||
def print(self, *args, end=None, sep=None, text_color=None, background_color=None, justification=None, font=None, colors=None, t=None, b=None, c=None, autoscroll=True, append=True):
|
||||
"""
|
||||
Print like Python normally prints except route the output to a multiline element and also add colors if desired
|
||||
|
||||
colors -(str, str) or str. A combined text/background color definition in a single parameter
|
||||
|
||||
There are also "aliases" for text_color, background_color and colors (t, b, c)
|
||||
t - An alias for color of the text (makes for shorter calls)
|
||||
b - An alias for the background_color parameter
|
||||
c - (str, str) - "shorthand" way of specifying color. (foreground, backgrouned)
|
||||
c - str - can also be a string of the format "foreground on background" ("white on red")
|
||||
|
||||
With the aliases it's possible to write the same print but in more compact ways:
|
||||
cprint('This will print white text on red background', c=('white', 'red'))
|
||||
cprint('This will print white text on red background', c='white on red')
|
||||
cprint('This will print white text on red background', text_color='white', background_color='red')
|
||||
cprint('This will print white text on red background', t='white', b='red')
|
||||
|
||||
:param args: The arguments to print
|
||||
:type args: (Any)
|
||||
:param end: The end char to use just like print uses
|
||||
:type end: (str)
|
||||
:param sep: The separation character like print uses
|
||||
:type sep: (str)
|
||||
:param text_color: The color of the text
|
||||
:type text_color: (str)
|
||||
:param background_color: The background color of the line
|
||||
:type background_color: (str)
|
||||
:param justification: text justification. left, right, center. Can use single characters l, r, c. Sets only for this value, not entire element
|
||||
:type justification: (str)
|
||||
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike for the args being printed
|
||||
:type font: (str or (str, int[, str]) or None)
|
||||
:param colors: Either a tuple or a string that has both the text and background colors. Or just the text color
|
||||
:type colors: (str) or (str, str)
|
||||
:param t: Color of the text
|
||||
:type t: (str)
|
||||
:param b: The background color of the line
|
||||
:type b: (str)
|
||||
:param c: Either a tuple or a string that has both the text and background colors or just tex color (same as the color parm)
|
||||
:type c: (str) or (str, str)
|
||||
:param autoscroll: If True the contents of the element will automatically scroll as more data added to the end
|
||||
:type autoscroll: (bool)
|
||||
"""
|
||||
|
||||
kw_text_color = text_color or t
|
||||
kw_background_color = background_color or b
|
||||
dual_color = colors or c
|
||||
try:
|
||||
if isinstance(dual_color, tuple):
|
||||
kw_text_color = dual_color[0]
|
||||
kw_background_color = dual_color[1]
|
||||
elif isinstance(dual_color, str):
|
||||
if ' on ' in dual_color: # if has "on" in the string, then have both text and background
|
||||
kw_text_color = dual_color.split(' on ')[0]
|
||||
kw_background_color = dual_color.split(' on ')[1]
|
||||
else: # if no "on" then assume the color string is just the text color
|
||||
kw_text_color = dual_color
|
||||
except Exception as e:
|
||||
print('* multiline print warning * you messed up with color formatting', e)
|
||||
|
||||
self._print_to_element( *args, end=end, sep=sep, text_color=kw_text_color, background_color=kw_background_color, justification=justification, autoscroll=autoscroll, font=font, append=append)
|
||||
|
||||
|
||||
Get = get
|
||||
Update = update
|
||||
|
||||
|
@ -7660,7 +7785,7 @@ class Table(Element):
|
|||
size=(None, None), s=(None, None), change_submits=False, enable_events=False, enable_click_events=False, bind_return_key=False, pad=None, p=None,
|
||||
key=None, k=None, tooltip=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None):
|
||||
"""
|
||||
:param values: ???
|
||||
:param values: Your table data represented as a 2-dimensions table... a list of rows, with each row representing a row in your table.
|
||||
:type values: List[List[str | int | float]]
|
||||
:param headings: The headings to show on the top line
|
||||
:type headings: List[str]
|
||||
|
@ -14225,7 +14350,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|||
|
||||
# ------------------------- COMBO placement element ------------------------- #
|
||||
elif element_type == ELEM_TYPE_INPUT_COMBO:
|
||||
element = element # type: InputCombo
|
||||
element = element # type: Combo
|
||||
max_line_len = max([len(str(l)) for l in element.Values]) if len(element.Values) else 0
|
||||
if auto_size_text is False:
|
||||
width = element_size[0]
|
||||
|
@ -14233,75 +14358,42 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|||
width = max_line_len + 1
|
||||
element.TKStringVar = tk.StringVar()
|
||||
style_name = _make_ttk_style_name('.TCombobox', element)
|
||||
# style_name = 'TCombobox'
|
||||
s = ttk.Style()
|
||||
if _valid_theme(s, toplevel_form.TtkTheme):
|
||||
s.theme_use(toplevel_form.TtkTheme)
|
||||
# s.theme_use('default')
|
||||
|
||||
if element.TextColor is not None and element.TextColor != COLOR_SYSTEM_DEFAULT:
|
||||
# Creates 1 style per Text Color/ Background Color combination
|
||||
# style_name = str(element.Key) + '.TCombobox'
|
||||
combostyle = ttk.Style()
|
||||
element.ttk_style = combostyle
|
||||
if _valid_theme(combostyle, toplevel_form.TtkTheme):
|
||||
combostyle.theme_use(toplevel_form.TtkTheme)
|
||||
|
||||
combostyle = ttk.Style()
|
||||
if _valid_theme(combostyle, toplevel_form.TtkTheme):
|
||||
combostyle.theme_use(toplevel_form.TtkTheme)
|
||||
|
||||
# Creates a unique name for each field element(Sure there is a better way to do this)
|
||||
# unique_field = str(element.Key) + '.TCombobox.field'
|
||||
unique_field = _make_ttk_style_name('.TCombobox.field', element)
|
||||
# Creates a unique name for each field element(Sure there is a better way to do this)
|
||||
unique_field = _make_ttk_style_name('.TCombobox.field', element)
|
||||
|
||||
|
||||
# Clones over the TCombobox.field element from the "alt" theme.
|
||||
# This is what will allow us to change the background color without altering the whole programs theme
|
||||
# Set individual widget options
|
||||
try:
|
||||
if element.TextColor not in (None, COLOR_SYSTEM_DEFAULT):
|
||||
combostyle.configure(style_name, foreground=element.TextColor)
|
||||
combostyle.configure(style_name, selectforeground=element.TextColor)
|
||||
combostyle.configure(style_name, insertcolor=element.TextColor)
|
||||
if element.BackgroundColor not in (None, COLOR_SYSTEM_DEFAULT):
|
||||
combostyle.configure(style_name, selectbackground=element.BackgroundColor)
|
||||
combostyle.map(style_name, fieldbackground=[('readonly', element.BackgroundColor)])
|
||||
combostyle.configure(style_name, fieldbackground=element.BackgroundColor)
|
||||
|
||||
# try: # if this element is in a window that's shown TWICE, will get an error here, so skip error
|
||||
# combostyle.element_create(unique_field, "from", "alt")
|
||||
# except:
|
||||
# pass
|
||||
|
||||
# Create widget layout using cloned "alt" field
|
||||
# combostyle.layout(style_name, [
|
||||
# (unique_field, {'children': [('Combobox.downarrow', {'side': 'right', 'sticky': 'ns'}),
|
||||
# ('Combobox.padding',
|
||||
# {'children': [('Combobox.focus',
|
||||
# {'children': [('Combobox.textarea',
|
||||
# {'sticky': 'nswe'})],
|
||||
# 'expand': '1',
|
||||
# 'sticky': 'nswe'})],
|
||||
# 'expand': '1',
|
||||
# 'sticky': 'nswe'})],
|
||||
# 'sticky': 'nswe'})])
|
||||
|
||||
# Copy default TCombobox settings
|
||||
# Getting an error on this line of code
|
||||
# combostyle.configure(style_name, *combostyle.configure("TCombobox"))
|
||||
|
||||
# Set individual widget options
|
||||
combostyle.configure(style_name, foreground=element.TextColor)
|
||||
combostyle.configure(style_name, selectbackground=element.BackgroundColor)
|
||||
combostyle.map(style_name, fieldbackground=[('readonly', element.BackgroundColor)])
|
||||
combostyle.configure(style_name, fieldbackground=element.BackgroundColor)
|
||||
combostyle.configure(style_name, selectforeground=element.TextColor)
|
||||
combostyle.configure(style_name, insertcolor=element.TextColor)
|
||||
|
||||
try:
|
||||
combostyle.configure(style_name, arrowcolor=theme_button_color()[0])
|
||||
combostyle.configure(style_name, background=theme_button_color()[1])
|
||||
except Exception as e:
|
||||
_error_popup_with_traceback('Combo Element error {}'.format(e),
|
||||
'Combo element key: {}'.format(element.Key),
|
||||
'The theme button color is used to make the arrows. theme_button_color= {}'.format(theme_button_color()),
|
||||
"Parent Window's Title: {}".format(toplevel_form.Title))
|
||||
# print('* Problem setting combobox button color *', e)
|
||||
if element.button_arrow_color not in (None, COLOR_SYSTEM_DEFAULT):
|
||||
combostyle.configure(style_name, arrowcolor=element.button_arrow_color)
|
||||
if element.button_background_color not in (None, COLOR_SYSTEM_DEFAULT):
|
||||
combostyle.configure(style_name, background=element.button_background_color)
|
||||
except Exception as e:
|
||||
_error_popup_with_traceback('Combo Element error {}'.format(e),
|
||||
'Combo element key: {}'.format(element.Key),
|
||||
'One of your colors is bad. Check the text, background, button background and button arrow colors',
|
||||
"Parent Window's Title: {}".format(toplevel_form.Title))
|
||||
|
||||
# Strange code that is needed to set the font for the drop-down list
|
||||
element._newfont = tkinter.font.Font(font=font)
|
||||
tk_row_frame.option_add("*TCombobox*Listbox*Font", element._newfont)
|
||||
|
||||
element.TKCombo = element.Widget = ttk.Combobox(tk_row_frame, width=width,
|
||||
textvariable=element.TKStringVar, font=font,
|
||||
style=style_name)
|
||||
element.TKCombo = element.Widget = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar, font=font, style=style_name)
|
||||
|
||||
# Chr0nic
|
||||
element.TKCombo.bind("<Enter>", lambda event, em=element: testMouseHook2(em))
|
||||
|
@ -15096,6 +15188,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|||
style_name = _make_ttk_style_name( '.customtable.Treeview', element)
|
||||
|
||||
table_style = ttk.Style()
|
||||
element.ttk_style = table_style
|
||||
|
||||
table_style.theme_use(toplevel_form.TtkTheme)
|
||||
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||
|
|
|
@ -1850,6 +1850,8 @@ Combo(values,
|
|||
auto_size_text = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
button_background_color = None,
|
||||
button_arrow_color = None,
|
||||
bind_return_key = False,
|
||||
change_submits = False,
|
||||
enable_events = False,
|
||||
|
@ -1871,27 +1873,30 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[Any] or Tuple[Any] | values | values to choose. While displayed as text, the items returned are what the caller supplied, not text |
|
||||
| Any | default_value | Choice to be displayed as initial value. Must match one of values variable contents |
|
||||
| (int, int) or (None, None) or int | size | width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int |
|
||||
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
| bool | auto_size_text | True if element should be the same size as the contents |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | bind_return_key | If True, then the return key will cause a the Combo to generate an event |
|
||||
| bool | change_submits | DEPRICATED DO NOT USE. Use `enable_events` instead |
|
||||
| bool | enable_events | Turns on the element specific events. Combo event is when a choice is made |
|
||||
| bool | disabled | set disable state for element |
|
||||
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
|
||||
| bool) :param tooltip: text that will appear when mouse hovers over this element | expand_y | If True the element will automatically expand in the Y direction to fill available space |
|
||||
| bool | readonly | make element readonly (user can't change). True means user cannot change |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| bool | visible | set visibility state of the element |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
| List[Any] or Tuple[Any] | values | values to choose. While displayed as text, the items returned are what the caller supplied, not text |
|
||||
| Any | default_value | Choice to be displayed as initial value. Must match one of values variable contents |
|
||||
| (int, int) or (None, None) or int | size | width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int |
|
||||
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
| bool | auto_size_text | True if element should be the same size as the contents |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str | button_background_color | The color of the background of the button on the combo box |
|
||||
| str | button_arrow_color | The color of the arrow on the button on the combo box |
|
||||
| bool | bind_return_key | If True, then the return key will cause a the Combo to generate an event |
|
||||
| bool | change_submits | DEPRICATED DO NOT USE. Use `enable_events` instead |
|
||||
| bool | enable_events | Turns on the element specific events. Combo event is when a choice is made |
|
||||
| bool | disabled | set disable state for element |
|
||||
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
|
||||
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
|
||||
| str | tooltip | text that will appear when mouse hovers over this element |
|
||||
| bool | readonly | make element readonly (user can't change). True means user cannot change |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| bool | visible | set visibility state of the element |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
|
||||
### bind
|
||||
|
||||
|
@ -6632,7 +6637,7 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[Column] | pane_list | Must be a list of Column Elements. Each Column supplied becomes one pane that's shown |
|
||||
| List[Column] or Tuple[Column] | pane_list | Must be a list of Column Elements. Each Column supplied becomes one pane that's shown |
|
||||
| str | background_color | color of background |
|
||||
| (int, int) | size | (width, height) w=characters-wide, h=rows-high How much room to reserve for the Pane |
|
||||
| (int, int) or (None, None) | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
|
@ -7683,15 +7688,25 @@ Parameter Descriptions:
|
|||
It should be placed on the last row of your window along with any other elements on that row.
|
||||
The color will match the theme's background color.
|
||||
|
||||
Sizegrip Element
|
||||
|
||||
```
|
||||
Sizegrip(background_color = None, key = None)
|
||||
Sizegrip(background_color = None,
|
||||
pad = None,
|
||||
p = (0, 0),
|
||||
key = None,
|
||||
k = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | background_color | color to use for the background of the grip |
|
||||
| str | background_color | color to use for the background of the grip |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| str or int or tuple or object | key | Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
|
||||
### bind
|
||||
|
||||
|
@ -9733,7 +9748,7 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[List[str or int or float]] | values | ??? |
|
||||
| List[List[str or int or float]] | values | Your table data represented as a list of rows, with each row representing a row in your table. |
|
||||
| List[str] | headings | The headings to show on the top line |
|
||||
| List[bool] | visible_column_map | One entry for each column. False indicates the column is not shown |
|
||||
| List[int] | col_widths | Number of characters that each column will occupy |
|
||||
|
@ -11195,59 +11210,59 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | title | The title that will be displayed in the Titlebar and on the Taskbar |
|
||||
| List[List[Elements]] | layout | The layout for the window. Can also be specified in the Layout method |
|
||||
| (int, int) - (width, height) | default_element_size | size in characters (wide) and rows (high) for all elements in this window |
|
||||
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
|
||||
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
|
||||
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
|
||||
| (int, int) | relative_location | (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
|
||||
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
|
||||
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
|
||||
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int) | margins | (left/right, top/bottom) Amount of pixels to leave inside the window's frame around the edges before your elements are shown. |
|
||||
| (str, str) or str | button_color | Default button colors for all buttons in the window |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| (str, str) | progress_bar_color | (bar color, background color) Sets the default colors for all progress bars in the window |
|
||||
| str | background_color | color of background |
|
||||
| int | border_depth | Default border depth (width) for all elements in the window |
|
||||
| bool | auto_close | If True, the window will automatically close itself |
|
||||
| int | auto_close_duration | Number of seconds to wait before closing the window |
|
||||
| (str or bytes) | icon | Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's |
|
||||
| bool | force_toplevel | If True will cause this window to skip the normal use of a hidden master window |
|
||||
| float | alpha_channel | Sets the opacity of the window. 0 = invisible 1 = completely visible. Values bewteen 0 & 1 will produce semi-transparent windows in SOME environments (The Raspberry Pi always has this value at 1 and cannot change. |
|
||||
| bool | return_keyboard_events | if True key presses on the keyboard will be returned as Events from Read calls |
|
||||
| bool | use_default_focus | If True will use the default focus algorithm to set the focus to the "Correct" element |
|
||||
| 'left' or 'right' or 'center' | text_justification | Default text justification for all Text Elements in window |
|
||||
| bool | no_titlebar | If true, no titlebar nor frame will be shown on window. This means you cannot minimize the window and it will not show up on the taskbar |
|
||||
| bool | grab_anywhere | If True can use mouse to click and drag to move the window. Almost every location of the window will work except input fields on some systems |
|
||||
| bool | grab_anywhere_using_control | If True can use CONTROL key + left mouse mouse to click and drag to move the window. DEFAULT is TRUE. Unlike normal grab anywhere, it works on all elements. |
|
||||
| bool | keep_on_top | If True, window will be created on top of all other windows on screen. It can be bumped down if another window created with this parm |
|
||||
| bool | resizable | If True, allows the user to resize the window. Note the not all Elements will change size or location when resizing. |
|
||||
| bool | disable_close | If True, the X button in the top right corner of the window will no work. Use with caution and always give a way out toyour users |
|
||||
| bool | disable_minimize | if True the user won't be able to minimize window. Good for taking over entire screen and staying that way. |
|
||||
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
|
||||
| str | transparent_color | Any portion of the window that has this color will be completely transparent. You can even click through these spots to the window under this window. |
|
||||
| bool | debugger_enabled | If True then the internal debugger will be enabled |
|
||||
| str | right_click_menu_background_color | Background color for right click menus |
|
||||
| str | right_click_menu_text_color | Text color for right click menus |
|
||||
| str | right_click_menu_disabled_text_color | Text color for disabled right click menu items |
|
||||
| (str, str) or str or Tuple | right_click_menu_selected_colors | Text AND background colors for a selected item. Can be a Tuple OR a color string. simplified-button-color-string "foreground on background". Can be a single color if want to set only the background. Normally a tuple, but can be a simplified-dual-color-string "foreground on background". Can be a single color if want to set only the background. |
|
||||
| (str or (str, int[, str]) or None) | right_click_menu_font | Font for right click menus |
|
||||
| bool | right_click_menu_tearoff | If True then all right click menus can be torn off |
|
||||
| bool | finalize | If True then the Finalize method will be called. Use this rather than chaining .Finalize for cleaner code |
|
||||
| str | element_justification | All elements in the Window itself will have this justification 'left', 'right', 'center' are valid values |
|
||||
| str | ttk_theme | Set the tkinter ttk "theme" of the window. Default = DEFAULT_TTK_THEME. Sets all ttk widgets to this theme as their default |
|
||||
| bool | use_ttk_buttons | Affects all buttons in window. True = use ttk buttons. False = do not use ttk buttons. None = use ttk buttons only if on a Mac |
|
||||
| bool | modal | If True then this window will be the only window a user can interact with until it is closed |
|
||||
| bool | enable_close_attempted_event | If True then the window will not close when "X" clicked. Instead an event WINDOW_CLOSE_ATTEMPTED_EVENT if returned from window.read |
|
||||
| (str or None) | titlebar_background_color | If custom titlebar indicated by use_custom_titlebar, then use this as background color |
|
||||
| (str or None) | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| (str or (str, int[, str]) or None) | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| (bytes or str) | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| bool | use_custom_titlebar | If True, then a custom titlebar will be used instead of the normal titlebar |
|
||||
| float | scaling | Apply scaling to the elements in the window. Can be set on a global basis using set_options |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
| str | title | The title that will be displayed in the Titlebar and on the Taskbar |
|
||||
| List[List[Element]] or Tuple[Tuple[Element]] | layout | The layout for the window. Can also be specified in the Layout method |
|
||||
| (int, int) - (width, height) | default_element_size | size in characters (wide) and rows (high) for all elements in this window |
|
||||
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
|
||||
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
|
||||
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
|
||||
| (int, int) | relative_location | (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
|
||||
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
|
||||
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
|
||||
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int) | margins | (left/right, top/bottom) Amount of pixels to leave inside the window's frame around the edges before your elements are shown. |
|
||||
| (str, str) or str | button_color | Default button colors for all buttons in the window |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| (str, str) | progress_bar_color | (bar color, background color) Sets the default colors for all progress bars in the window |
|
||||
| str | background_color | color of background |
|
||||
| int | border_depth | Default border depth (width) for all elements in the window |
|
||||
| bool | auto_close | If True, the window will automatically close itself |
|
||||
| int | auto_close_duration | Number of seconds to wait before closing the window |
|
||||
| (str or bytes) | icon | Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's |
|
||||
| bool | force_toplevel | If True will cause this window to skip the normal use of a hidden master window |
|
||||
| float | alpha_channel | Sets the opacity of the window. 0 = invisible 1 = completely visible. Values bewteen 0 & 1 will produce semi-transparent windows in SOME environments (The Raspberry Pi always has this value at 1 and cannot change. |
|
||||
| bool | return_keyboard_events | if True key presses on the keyboard will be returned as Events from Read calls |
|
||||
| bool | use_default_focus | If True will use the default focus algorithm to set the focus to the "Correct" element |
|
||||
| 'left' or 'right' or 'center' | text_justification | Default text justification for all Text Elements in window |
|
||||
| bool | no_titlebar | If true, no titlebar nor frame will be shown on window. This means you cannot minimize the window and it will not show up on the taskbar |
|
||||
| bool | grab_anywhere | If True can use mouse to click and drag to move the window. Almost every location of the window will work except input fields on some systems |
|
||||
| bool | grab_anywhere_using_control | If True can use CONTROL key + left mouse mouse to click and drag to move the window. DEFAULT is TRUE. Unlike normal grab anywhere, it works on all elements. |
|
||||
| bool | keep_on_top | If True, window will be created on top of all other windows on screen. It can be bumped down if another window created with this parm |
|
||||
| bool | resizable | If True, allows the user to resize the window. Note the not all Elements will change size or location when resizing. |
|
||||
| bool | disable_close | If True, the X button in the top right corner of the window will no work. Use with caution and always give a way out toyour users |
|
||||
| bool | disable_minimize | if True the user won't be able to minimize window. Good for taking over entire screen and staying that way. |
|
||||
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
|
||||
| str | transparent_color | Any portion of the window that has this color will be completely transparent. You can even click through these spots to the window under this window. |
|
||||
| bool | debugger_enabled | If True then the internal debugger will be enabled |
|
||||
| str | right_click_menu_background_color | Background color for right click menus |
|
||||
| str | right_click_menu_text_color | Text color for right click menus |
|
||||
| str | right_click_menu_disabled_text_color | Text color for disabled right click menu items |
|
||||
| (str, str) or str or Tuple | right_click_menu_selected_colors | Text AND background colors for a selected item. Can be a Tuple OR a color string. simplified-button-color-string "foreground on background". Can be a single color if want to set only the background. Normally a tuple, but can be a simplified-dual-color-string "foreground on background". Can be a single color if want to set only the background. |
|
||||
| (str or (str, int[, str]) or None) | right_click_menu_font | Font for right click menus |
|
||||
| bool | right_click_menu_tearoff | If True then all right click menus can be torn off |
|
||||
| bool | finalize | If True then the Finalize method will be called. Use this rather than chaining .Finalize for cleaner code |
|
||||
| str | element_justification | All elements in the Window itself will have this justification 'left', 'right', 'center' are valid values |
|
||||
| str | ttk_theme | Set the tkinter ttk "theme" of the window. Default = DEFAULT_TTK_THEME. Sets all ttk widgets to this theme as their default |
|
||||
| bool | use_ttk_buttons | Affects all buttons in window. True = use ttk buttons. False = do not use ttk buttons. None = use ttk buttons only if on a Mac |
|
||||
| bool | modal | If True then this window will be the only window a user can interact with until it is closed |
|
||||
| bool | enable_close_attempted_event | If True then the window will not close when "X" clicked. Instead an event WINDOW_CLOSE_ATTEMPTED_EVENT if returned from window.read |
|
||||
| (str or None) | titlebar_background_color | If custom titlebar indicated by use_custom_titlebar, then use this as background color |
|
||||
| (str or None) | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| (str or (str, int[, str]) or None) | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| (bytes or str) | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| bool | use_custom_titlebar | If True, then a custom titlebar will be used instead of the normal titlebar |
|
||||
| float | scaling | Apply scaling to the elements in the window. Can be set on a global basis using set_options |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
|
||||
### add_row
|
||||
|
||||
|
@ -17459,7 +17474,8 @@ execute_command_subprocess(command,
|
|||
wait = False,
|
||||
cwd = None,
|
||||
pipe_output = False,
|
||||
merge_stderr_with_stdout = True)
|
||||
merge_stderr_with_stdout = True,
|
||||
stdin = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
@ -17472,6 +17488,7 @@ Parameter Descriptions:
|
|||
| str | cwd | Working directory to use when executing the subprocess |
|
||||
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
|
||||
| bool | merge_stderr_with_stdout | If True then output from the subprocess stderr will be merged with stdout. The result is ALL output will be on stdout. |
|
||||
| bool | stdin | Value passed to the Popen call. Defaults to subprocess.DEVNULL so that the pyinstaller created executable work correctly |
|
||||
| (subprocess.Popen) | **RETURN** | Popen object
|
||||
|
||||
Runs the editor that was configured in the global settings and opens the file to a specific line number.
|
||||
|
|
225
docs/index.md
225
docs/index.md
|
@ -3496,9 +3496,61 @@ And the window it creates looks like this:
|
|||
|
||||
# Elements
|
||||
|
||||
You will find information on Elements and all other classes and functions are located near the end of this manual. They are in 1 large section of the readme, in alphabetical order for easy lookups. This section's discussion of Elements is meant to teach you how they work. The other section has detailed call signatures and parameter definitions.
|
||||
You will find information on Elements and all other classes and functions are located in the Call Reference Tab of the documentation.
|
||||
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements.
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. So that it's clear when a PySimpleGUI *Element* is being referenced versus an underlying GUI Framework's *Widget*. PySimpleGUI Elements map to a GUI Framework Widget, usually in a 1-to-1 manner. For example, a Text Element is implemented in tkinter using a Label Widget.
|
||||
|
||||
## Table of Elements in Tkinter Port
|
||||
|
||||
Each port of PySimpleGUI has a core set of Elements as well as port-specific elements. Some port-specific elements include the Dial element in the Qt port, and the Pane element in the tkinter port.
|
||||
|
||||
| Element Name | Aliases | tkinter Widget | Description |
|
||||
| :------------------ | :----------------------------- | :------------- | :------------------------ |
|
||||
| Text | T, Txt | tk.Label | One or more lines of Text |
|
||||
| Input | I, In, InputText | tk.Entry | Single line text input |
|
||||
| Combo | DD, Drop, DropDown, InputCombo | | |
|
||||
| OptionMenu | InputOptionMenu | | |
|
||||
| Multiline | ML, MLine | | |
|
||||
| Output | | | |
|
||||
| Radio | R, Rad | | |
|
||||
| Checkbox | CB, CBox, Check | | |
|
||||
| Spin | Sp | | |
|
||||
| Button | B, Btn | | |
|
||||
| Image | Im | | |
|
||||
| Canvas | | | |
|
||||
| Column | Col | | |
|
||||
| Frame | Fr | | |
|
||||
| Tab | | | |
|
||||
| TabGroup | | | |
|
||||
| Pane | | | |
|
||||
| Graph | G | | |
|
||||
| Slider | Sl | | |
|
||||
| Listbox | LB, LBox | | |
|
||||
| Menu | MenuBar, Menubar | | |
|
||||
| MenubarCustom | | | |
|
||||
| ButtonMenu | BM, BMenu | | |
|
||||
| Titlebar | | | |
|
||||
| ProgressBar | PBar, Prog, Progress | | |
|
||||
| Table | | | |
|
||||
| Tree | | | |
|
||||
| VerticalSeparator | VSep, VSeparator | | |
|
||||
| HorizontalSeparator | HSep, HSeparator | | |
|
||||
| StatusBar | SBar | | |
|
||||
| Sizegrip | SGrip | | |
|
||||
| Push | P, Stretch | | |
|
||||
| VPush | VP, VStretch | | |
|
||||
| Sizer | | | |
|
||||
|
||||
## Layout Helper Functions
|
||||
|
||||
Your Window's layout is composed of lists of Elements. In addition to elements, these Layout Help Functions may also be present in a layout definition
|
||||
|
||||
| Layout Helper | Description |
|
||||
| :------------ | :---------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| pin | "Pins" an element to a location in a layout. If element transitions from invisible to visible, pin ensures element is in correct location |
|
||||
| vtop | Vertically align element or row of elements to the top of the row |
|
||||
| vbottom | Vertically align element or row of elements to the bottom of the row |
|
||||
| vcenter | Vertically align element or row of elements to the center of the row |
|
||||
|
||||
- Text
|
||||
- Single Line Input
|
||||
|
@ -3510,29 +3562,6 @@ You will find information on Elements and all other classes and functions are lo
|
|||
- Read window
|
||||
- Close window ("Button" & all shortcut buttons)
|
||||
- Realtime
|
||||
- Checkboxes
|
||||
- Radio Buttons
|
||||
- Listbox
|
||||
- Slider
|
||||
- Multi-line Text Input/Output
|
||||
- Multi-line Text Output (not on tkinter version)
|
||||
- Scroll-able Output
|
||||
- Vertical Separator
|
||||
- Progress Bar
|
||||
- Option Menu
|
||||
- Menu
|
||||
- ButtonMenu
|
||||
- Frame
|
||||
- Column
|
||||
- Graph
|
||||
- Image
|
||||
- Table
|
||||
- Tree
|
||||
- Tab, TabGroup
|
||||
- StatusBar
|
||||
- Pane
|
||||
- Stretch (Qt only)
|
||||
- Sizer (plain PySimpleGUI only)
|
||||
|
||||
## Keys
|
||||
|
||||
|
@ -5568,29 +5597,159 @@ You can also set the cursor for the Window as a whole, including the margins and
|
|||
|
||||
## Valid Cursor Strings
|
||||
|
||||
`X_cursor, arrow, based_arrow_down, based_arrow_up, boat, bogosity, bottom_left_corner, bottom_right_corner, bottom_side, bottom_tee, box_spiral, center_ptr, circle, clock, coffee_mug, cross, cross_reverse, crosshair, diamond_cross, dot, dotbox, double_arrow, draft_large, draft_small, draped_box, exchange, fleur, gobbler, gumby, hand1, hand2, heart, icon, iron_cross, left_ptr, left_side, left_tee, leftbutton, ll_angle, lr_angle, man, middlebutton, mouse, pencil, pirate, plus, question_arrow, right_ptr, right_side, right_tee, rightbutton, rtl_logo, sailboat, sb_down_arrow, sb_h_double_arrow, sb_left_arrow, sb_right_arrow, sb_up_arrow, sb_v_double_arrow, shuttle, sizing, spider, spraycan, star, target, tcross, top_left_arrow, top_left_corner, top_right_corner, top_side, top_tee, trek, ul_angle, umbrella, ur_angle, watch, xterm`
|
||||
```
|
||||
X_cursor
|
||||
arrow
|
||||
based_arrow_down
|
||||
based_arrow_up
|
||||
boat
|
||||
bogosity
|
||||
bottom_left_corner
|
||||
bottom_right_corner
|
||||
bottom_side
|
||||
bottom_tee
|
||||
box_spiral
|
||||
center_ptr
|
||||
circle
|
||||
clock
|
||||
coffee_mug
|
||||
cross
|
||||
cross_reverse
|
||||
crosshair
|
||||
diamond_cross
|
||||
dot
|
||||
dotbox
|
||||
double_arrow
|
||||
draft_large
|
||||
draft_small
|
||||
draped_box
|
||||
exchange
|
||||
fleur
|
||||
gobbler
|
||||
gumby
|
||||
hand1
|
||||
hand2
|
||||
heart
|
||||
icon
|
||||
iron_cross
|
||||
left_ptr
|
||||
left_side
|
||||
left_tee
|
||||
leftbutton
|
||||
ll_angle
|
||||
lr_angle
|
||||
man
|
||||
middlebutton
|
||||
mouse
|
||||
pencil
|
||||
pirate
|
||||
plus
|
||||
question_arrow
|
||||
right_ptr
|
||||
right_side
|
||||
right_tee
|
||||
rightbutton
|
||||
rtl_logo
|
||||
sailboat
|
||||
sb_down_arrow
|
||||
sb_h_double_arrow
|
||||
sb_left_arrow
|
||||
sb_right_arrow
|
||||
sb_up_arrow
|
||||
sb_v_double_arrow
|
||||
shuttle
|
||||
sizing
|
||||
spider
|
||||
spraycan
|
||||
star
|
||||
target
|
||||
tcross
|
||||
top_left_arrow
|
||||
top_left_corner
|
||||
top_right_corner
|
||||
top_side
|
||||
top_tee
|
||||
trek
|
||||
ul_angle
|
||||
umbrella
|
||||
ur_angle
|
||||
watch
|
||||
xterm
|
||||
|
||||
```
|
||||
|
||||
## No Cursor
|
||||
|
||||
To specify no cursor should be shown, the cursor `'no'` can be used on some platforms
|
||||
If you want your mouse cursor to be invisible, then use the **string** `"none"` and your element or window will not show any cursor.
|
||||
|
||||
## Windows OS Specific
|
||||
|
||||
One windows, these cursors map to native Windows cursors:
|
||||
|
||||
`arrow, center_ptr, crosshair, fleur, ibeam, icon, sb_h_double_arrow, sb_v_double_arrow, watch, xterm`
|
||||
```
|
||||
arrow
|
||||
center_ptr
|
||||
crosshair
|
||||
fleur
|
||||
ibeam
|
||||
icon
|
||||
sb_h_double_arrow
|
||||
sb_v_double_arrow
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
And these are also available:
|
||||
These are also available:
|
||||
|
||||
`no, starting, size, size_ne_sw, size_ns, size_nw_se, size_we, uparrow, wait`
|
||||
```
|
||||
no
|
||||
starting
|
||||
size
|
||||
size_ne_sw
|
||||
size_ns
|
||||
size_nw_se
|
||||
size_we
|
||||
uparrow
|
||||
wait
|
||||
```
|
||||
|
||||
## Mac OS Specific
|
||||
|
||||
`arrow, cross, crosshair, ibeam, plus, watch, xterm`
|
||||
```
|
||||
arrow
|
||||
cross
|
||||
crosshair
|
||||
ibeam
|
||||
plus
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
And these additional native cursors are available for the Mac
|
||||
These additional native cursors are available for the Mac
|
||||
|
||||
`copyarrow, aliasarrow, contextualmenuarrow, text, cross-hair, closedhand, openhand, pointinghand, resizeleft, resizeright, resizeleftright, resizeup, resizedown, resizeupdown, none, notallowed, poof, countinguphand, countingdownhand, countingupanddownhand, spinning`
|
||||
```
|
||||
copyarrow
|
||||
aliasarrow
|
||||
contextualmenuarrow
|
||||
text
|
||||
cross-hair
|
||||
closedhand
|
||||
openhand
|
||||
pointinghand
|
||||
resizeleft
|
||||
resizeright
|
||||
resizeleftright
|
||||
resizeup
|
||||
resizedown
|
||||
resizeupdown
|
||||
none
|
||||
notallowed
|
||||
poof
|
||||
countinguphand
|
||||
countingdownhand
|
||||
countingupanddownhand
|
||||
spinning
|
||||
```
|
||||
|
||||
# Keyboard & Mouse Capture
|
||||
|
||||
|
|
|
@ -1835,9 +1835,68 @@ And the window it creates looks like this:
|
|||
|
||||
# Elements
|
||||
|
||||
You will find information on Elements and all other classes and functions are located near the end of this manual. They are in 1 large section of the readme, in alphabetical order for easy lookups. This section's discussion of Elements is meant to teach you how they work. The other section has detailed call signatures and parameter definitions.
|
||||
You will find information on Elements and all other classes and functions are located in the Call Reference Tab of the documentation.
|
||||
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. So that it's clear when a PySimpleGUI *Element* is being referenced versus an underlying GUI Framework's *Widget*. PySimpleGUI Elements map to a GUI Framework Widget, usually in a 1-to-1 manner. For example, a Text Element is implemented in tkinter using a Label Widget.
|
||||
|
||||
## Table of Elements in Tkinter Port
|
||||
|
||||
Each port of PySimpleGUI has a core set of Elements as well as port-specific elements. Some port-specific elements include the Dial element in the Qt port, and the Pane element in the tkinter port.
|
||||
|
||||
| Element Name | Aliases | tkinter Widget | Description |
|
||||
| :------------------ | :----------------------------- | :------------- | :------------------------ |
|
||||
| Text | T, Txt | tk.Label | One or more lines of Text |
|
||||
| Input | I, In, InputText | tk.Entry | Single line text input |
|
||||
| Combo | DD, Drop, DropDown, InputCombo | | |
|
||||
| OptionMenu | InputOptionMenu | | |
|
||||
| Multiline | ML, MLine | | |
|
||||
| Output | | | |
|
||||
| Radio | R, Rad | | |
|
||||
| Checkbox | CB, CBox, Check | | |
|
||||
| Spin | Sp | | |
|
||||
| Button | B, Btn | | |
|
||||
| Image | Im | | |
|
||||
| Canvas | | | |
|
||||
| Column | Col | | |
|
||||
| Frame | Fr | | |
|
||||
| Tab | | | |
|
||||
| TabGroup | | | |
|
||||
| Pane | | | |
|
||||
| Graph | G | | |
|
||||
| Slider | Sl | | |
|
||||
| Listbox | LB, LBox | | |
|
||||
| Menu | MenuBar, Menubar | | |
|
||||
| MenubarCustom | | | |
|
||||
| ButtonMenu | BM, BMenu | | |
|
||||
| Titlebar | | | |
|
||||
| ProgressBar | PBar, Prog, Progress | | |
|
||||
| Table | | | |
|
||||
| Tree | | | |
|
||||
| VerticalSeparator | VSep, VSeparator | | |
|
||||
| HorizontalSeparator | HSep, HSeparator | | |
|
||||
| StatusBar | SBar | | |
|
||||
| Sizegrip | SGrip | | |
|
||||
| Push | P, Stretch | | |
|
||||
| VPush | VP, VStretch | | |
|
||||
| Sizer | | | |
|
||||
|
||||
|
||||
## Layout Helper Functions
|
||||
|
||||
Your Window's layout is composed of lists of Elements. In addition to elements, these Layout Help Functions may also be present in a layout definition
|
||||
|
||||
|
||||
| Layout Helper | Description |
|
||||
| :------------ | :---------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| pin | "Pins" an element to a location in a layout. If element transitions from invisible to visible, pin ensures element is in correct location |
|
||||
| vtop | Vertically align element or row of elements to the top of the row |
|
||||
| vbottom | Vertically align element or row of elements to the bottom of the row |
|
||||
| vcenter | Vertically align element or row of elements to the center of the row |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements.
|
||||
|
||||
- Text
|
||||
- Single Line Input
|
||||
|
@ -1849,29 +1908,7 @@ You will find information on Elements and all other classes and functions are lo
|
|||
- Read window
|
||||
- Close window ("Button" & all shortcut buttons)
|
||||
- Realtime
|
||||
- Checkboxes
|
||||
- Radio Buttons
|
||||
- Listbox
|
||||
- Slider
|
||||
- Multi-line Text Input/Output
|
||||
- Multi-line Text Output (not on tkinter version)
|
||||
- Scroll-able Output
|
||||
- Vertical Separator
|
||||
- Progress Bar
|
||||
- Option Menu
|
||||
- Menu
|
||||
- ButtonMenu
|
||||
- Frame
|
||||
- Column
|
||||
- Graph
|
||||
- Image
|
||||
- Table
|
||||
- Tree
|
||||
- Tab, TabGroup
|
||||
- StatusBar
|
||||
- Pane
|
||||
- Stretch (Qt only)
|
||||
- Sizer (plain PySimpleGUI only)
|
||||
|
||||
|
||||
## Keys
|
||||
|
||||
|
@ -4057,30 +4094,166 @@ You can also set the cursor for the Window as a whole, including the margins and
|
|||
|
||||
## Valid Cursor Strings
|
||||
|
||||
`X_cursor, arrow, based_arrow_down, based_arrow_up, boat, bogosity, bottom_left_corner, bottom_right_corner, bottom_side, bottom_tee, box_spiral, center_ptr, circle, clock, coffee_mug, cross, cross_reverse, crosshair, diamond_cross, dot, dotbox, double_arrow, draft_large, draft_small, draped_box, exchange, fleur, gobbler, gumby, hand1, hand2, heart, icon, iron_cross, left_ptr, left_side, left_tee, leftbutton, ll_angle, lr_angle, man, middlebutton, mouse, pencil, pirate, plus, question_arrow, right_ptr, right_side, right_tee, rightbutton, rtl_logo, sailboat, sb_down_arrow, sb_h_double_arrow, sb_left_arrow, sb_right_arrow, sb_up_arrow, sb_v_double_arrow, shuttle, sizing, spider, spraycan, star, target, tcross, top_left_arrow, top_left_corner, top_right_corner, top_side, top_tee, trek, ul_angle, umbrella, ur_angle, watch, xterm`
|
||||
|
||||
```
|
||||
X_cursor
|
||||
arrow
|
||||
based_arrow_down
|
||||
based_arrow_up
|
||||
boat
|
||||
bogosity
|
||||
bottom_left_corner
|
||||
bottom_right_corner
|
||||
bottom_side
|
||||
bottom_tee
|
||||
box_spiral
|
||||
center_ptr
|
||||
circle
|
||||
clock
|
||||
coffee_mug
|
||||
cross
|
||||
cross_reverse
|
||||
crosshair
|
||||
diamond_cross
|
||||
dot
|
||||
dotbox
|
||||
double_arrow
|
||||
draft_large
|
||||
draft_small
|
||||
draped_box
|
||||
exchange
|
||||
fleur
|
||||
gobbler
|
||||
gumby
|
||||
hand1
|
||||
hand2
|
||||
heart
|
||||
icon
|
||||
iron_cross
|
||||
left_ptr
|
||||
left_side
|
||||
left_tee
|
||||
leftbutton
|
||||
ll_angle
|
||||
lr_angle
|
||||
man
|
||||
middlebutton
|
||||
mouse
|
||||
pencil
|
||||
pirate
|
||||
plus
|
||||
question_arrow
|
||||
right_ptr
|
||||
right_side
|
||||
right_tee
|
||||
rightbutton
|
||||
rtl_logo
|
||||
sailboat
|
||||
sb_down_arrow
|
||||
sb_h_double_arrow
|
||||
sb_left_arrow
|
||||
sb_right_arrow
|
||||
sb_up_arrow
|
||||
sb_v_double_arrow
|
||||
shuttle
|
||||
sizing
|
||||
spider
|
||||
spraycan
|
||||
star
|
||||
target
|
||||
tcross
|
||||
top_left_arrow
|
||||
top_left_corner
|
||||
top_right_corner
|
||||
top_side
|
||||
top_tee
|
||||
trek
|
||||
ul_angle
|
||||
umbrella
|
||||
ur_angle
|
||||
watch
|
||||
xterm
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## No Cursor
|
||||
|
||||
To specify no cursor should be shown, the cursor `'no'` can be used on some platforms
|
||||
If you want your mouse cursor to be invisible, then use the **string** `"none"` and your element or window will not show any cursor.
|
||||
|
||||
|
||||
## Windows OS Specific
|
||||
|
||||
One windows, these cursors map to native Windows cursors:
|
||||
|
||||
`arrow, center_ptr, crosshair, fleur, ibeam, icon, sb_h_double_arrow, sb_v_double_arrow, watch, xterm`
|
||||
```
|
||||
arrow
|
||||
center_ptr
|
||||
crosshair
|
||||
fleur
|
||||
ibeam
|
||||
icon
|
||||
sb_h_double_arrow
|
||||
sb_v_double_arrow
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
And these are also available:
|
||||
These are also available:
|
||||
|
||||
```
|
||||
no
|
||||
starting
|
||||
size
|
||||
size_ne_sw
|
||||
size_ns
|
||||
size_nw_se
|
||||
size_we
|
||||
uparrow
|
||||
wait
|
||||
```
|
||||
|
||||
`no, starting, size, size_ne_sw, size_ns, size_nw_se, size_we, uparrow, wait`
|
||||
|
||||
## Mac OS Specific
|
||||
|
||||
`arrow, cross, crosshair, ibeam, plus, watch, xterm`
|
||||
|
||||
And these additional native cursors are available for the Mac
|
||||
```
|
||||
arrow
|
||||
cross
|
||||
crosshair
|
||||
ibeam
|
||||
plus
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
`copyarrow, aliasarrow, contextualmenuarrow, text, cross-hair, closedhand, openhand, pointinghand, resizeleft, resizeright, resizeleftright, resizeup, resizedown, resizeupdown, none, notallowed, poof, countinguphand, countingdownhand, countingupanddownhand, spinning`
|
||||
|
||||
These additional native cursors are available for the Mac
|
||||
|
||||
```
|
||||
copyarrow
|
||||
aliasarrow
|
||||
contextualmenuarrow
|
||||
text
|
||||
cross-hair
|
||||
closedhand
|
||||
openhand
|
||||
pointinghand
|
||||
resizeleft
|
||||
resizeright
|
||||
resizeleftright
|
||||
resizeup
|
||||
resizedown
|
||||
resizeupdown
|
||||
none
|
||||
notallowed
|
||||
poof
|
||||
countinguphand
|
||||
countingdownhand
|
||||
countingupanddownhand
|
||||
spinning
|
||||
```
|
||||
|
||||
|
||||
# Keyboard & Mouse Capture
|
||||
|
|
|
@ -1850,6 +1850,8 @@ Combo(values,
|
|||
auto_size_text = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
button_background_color = None,
|
||||
button_arrow_color = None,
|
||||
bind_return_key = False,
|
||||
change_submits = False,
|
||||
enable_events = False,
|
||||
|
@ -1871,27 +1873,30 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[Any] or Tuple[Any] | values | values to choose. While displayed as text, the items returned are what the caller supplied, not text |
|
||||
| Any | default_value | Choice to be displayed as initial value. Must match one of values variable contents |
|
||||
| (int, int) or (None, None) or int | size | width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int |
|
||||
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
| bool | auto_size_text | True if element should be the same size as the contents |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | bind_return_key | If True, then the return key will cause a the Combo to generate an event |
|
||||
| bool | change_submits | DEPRICATED DO NOT USE. Use `enable_events` instead |
|
||||
| bool | enable_events | Turns on the element specific events. Combo event is when a choice is made |
|
||||
| bool | disabled | set disable state for element |
|
||||
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
|
||||
| bool) :param tooltip: text that will appear when mouse hovers over this element | expand_y | If True the element will automatically expand in the Y direction to fill available space |
|
||||
| bool | readonly | make element readonly (user can't change). True means user cannot change |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| bool | visible | set visibility state of the element |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
| List[Any] or Tuple[Any] | values | values to choose. While displayed as text, the items returned are what the caller supplied, not text |
|
||||
| Any | default_value | Choice to be displayed as initial value. Must match one of values variable contents |
|
||||
| (int, int) or (None, None) or int | size | width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. If an Int is passed rather than a tuple, then height is auto-set to 1 and width is value of the int |
|
||||
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
| bool | auto_size_text | True if element should be the same size as the contents |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str | button_background_color | The color of the background of the button on the combo box |
|
||||
| str | button_arrow_color | The color of the arrow on the button on the combo box |
|
||||
| bool | bind_return_key | If True, then the return key will cause a the Combo to generate an event |
|
||||
| bool | change_submits | DEPRICATED DO NOT USE. Use `enable_events` instead |
|
||||
| bool | enable_events | Turns on the element specific events. Combo event is when a choice is made |
|
||||
| bool | disabled | set disable state for element |
|
||||
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
|
||||
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
|
||||
| str | tooltip | text that will appear when mouse hovers over this element |
|
||||
| bool | readonly | make element readonly (user can't change). True means user cannot change |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| bool | visible | set visibility state of the element |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
|
||||
### bind
|
||||
|
||||
|
@ -6632,7 +6637,7 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[Column] | pane_list | Must be a list of Column Elements. Each Column supplied becomes one pane that's shown |
|
||||
| List[Column] or Tuple[Column] | pane_list | Must be a list of Column Elements. Each Column supplied becomes one pane that's shown |
|
||||
| str | background_color | color of background |
|
||||
| (int, int) | size | (width, height) w=characters-wide, h=rows-high How much room to reserve for the Pane |
|
||||
| (int, int) or (None, None) | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
|
||||
|
@ -7683,15 +7688,25 @@ Parameter Descriptions:
|
|||
It should be placed on the last row of your window along with any other elements on that row.
|
||||
The color will match the theme's background color.
|
||||
|
||||
Sizegrip Element
|
||||
|
||||
```
|
||||
Sizegrip(background_color = None, key = None)
|
||||
Sizegrip(background_color = None,
|
||||
pad = None,
|
||||
p = (0, 0),
|
||||
key = None,
|
||||
k = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | background_color | color to use for the background of the grip |
|
||||
| str | background_color | color to use for the background of the grip |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
|
||||
| str or int or tuple or object | key | Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window |
|
||||
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
|
||||
|
||||
### bind
|
||||
|
||||
|
@ -9733,7 +9748,7 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| List[List[str or int or float]] | values | ??? |
|
||||
| List[List[str or int or float]] | values | Your table data represented as a list of rows, with each row representing a row in your table. |
|
||||
| List[str] | headings | The headings to show on the top line |
|
||||
| List[bool] | visible_column_map | One entry for each column. False indicates the column is not shown |
|
||||
| List[int] | col_widths | Number of characters that each column will occupy |
|
||||
|
@ -11195,59 +11210,59 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | title | The title that will be displayed in the Titlebar and on the Taskbar |
|
||||
| List[List[Elements]] | layout | The layout for the window. Can also be specified in the Layout method |
|
||||
| (int, int) - (width, height) | default_element_size | size in characters (wide) and rows (high) for all elements in this window |
|
||||
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
|
||||
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
|
||||
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
|
||||
| (int, int) | relative_location | (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
|
||||
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
|
||||
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
|
||||
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int) | margins | (left/right, top/bottom) Amount of pixels to leave inside the window's frame around the edges before your elements are shown. |
|
||||
| (str, str) or str | button_color | Default button colors for all buttons in the window |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| (str, str) | progress_bar_color | (bar color, background color) Sets the default colors for all progress bars in the window |
|
||||
| str | background_color | color of background |
|
||||
| int | border_depth | Default border depth (width) for all elements in the window |
|
||||
| bool | auto_close | If True, the window will automatically close itself |
|
||||
| int | auto_close_duration | Number of seconds to wait before closing the window |
|
||||
| (str or bytes) | icon | Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's |
|
||||
| bool | force_toplevel | If True will cause this window to skip the normal use of a hidden master window |
|
||||
| float | alpha_channel | Sets the opacity of the window. 0 = invisible 1 = completely visible. Values bewteen 0 & 1 will produce semi-transparent windows in SOME environments (The Raspberry Pi always has this value at 1 and cannot change. |
|
||||
| bool | return_keyboard_events | if True key presses on the keyboard will be returned as Events from Read calls |
|
||||
| bool | use_default_focus | If True will use the default focus algorithm to set the focus to the "Correct" element |
|
||||
| 'left' or 'right' or 'center' | text_justification | Default text justification for all Text Elements in window |
|
||||
| bool | no_titlebar | If true, no titlebar nor frame will be shown on window. This means you cannot minimize the window and it will not show up on the taskbar |
|
||||
| bool | grab_anywhere | If True can use mouse to click and drag to move the window. Almost every location of the window will work except input fields on some systems |
|
||||
| bool | grab_anywhere_using_control | If True can use CONTROL key + left mouse mouse to click and drag to move the window. DEFAULT is TRUE. Unlike normal grab anywhere, it works on all elements. |
|
||||
| bool | keep_on_top | If True, window will be created on top of all other windows on screen. It can be bumped down if another window created with this parm |
|
||||
| bool | resizable | If True, allows the user to resize the window. Note the not all Elements will change size or location when resizing. |
|
||||
| bool | disable_close | If True, the X button in the top right corner of the window will no work. Use with caution and always give a way out toyour users |
|
||||
| bool | disable_minimize | if True the user won't be able to minimize window. Good for taking over entire screen and staying that way. |
|
||||
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
|
||||
| str | transparent_color | Any portion of the window that has this color will be completely transparent. You can even click through these spots to the window under this window. |
|
||||
| bool | debugger_enabled | If True then the internal debugger will be enabled |
|
||||
| str | right_click_menu_background_color | Background color for right click menus |
|
||||
| str | right_click_menu_text_color | Text color for right click menus |
|
||||
| str | right_click_menu_disabled_text_color | Text color for disabled right click menu items |
|
||||
| (str, str) or str or Tuple | right_click_menu_selected_colors | Text AND background colors for a selected item. Can be a Tuple OR a color string. simplified-button-color-string "foreground on background". Can be a single color if want to set only the background. Normally a tuple, but can be a simplified-dual-color-string "foreground on background". Can be a single color if want to set only the background. |
|
||||
| (str or (str, int[, str]) or None) | right_click_menu_font | Font for right click menus |
|
||||
| bool | right_click_menu_tearoff | If True then all right click menus can be torn off |
|
||||
| bool | finalize | If True then the Finalize method will be called. Use this rather than chaining .Finalize for cleaner code |
|
||||
| str | element_justification | All elements in the Window itself will have this justification 'left', 'right', 'center' are valid values |
|
||||
| str | ttk_theme | Set the tkinter ttk "theme" of the window. Default = DEFAULT_TTK_THEME. Sets all ttk widgets to this theme as their default |
|
||||
| bool | use_ttk_buttons | Affects all buttons in window. True = use ttk buttons. False = do not use ttk buttons. None = use ttk buttons only if on a Mac |
|
||||
| bool | modal | If True then this window will be the only window a user can interact with until it is closed |
|
||||
| bool | enable_close_attempted_event | If True then the window will not close when "X" clicked. Instead an event WINDOW_CLOSE_ATTEMPTED_EVENT if returned from window.read |
|
||||
| (str or None) | titlebar_background_color | If custom titlebar indicated by use_custom_titlebar, then use this as background color |
|
||||
| (str or None) | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| (str or (str, int[, str]) or None) | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| (bytes or str) | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| bool | use_custom_titlebar | If True, then a custom titlebar will be used instead of the normal titlebar |
|
||||
| float | scaling | Apply scaling to the elements in the window. Can be set on a global basis using set_options |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
| str | title | The title that will be displayed in the Titlebar and on the Taskbar |
|
||||
| List[List[Element]] or Tuple[Tuple[Element]] | layout | The layout for the window. Can also be specified in the Layout method |
|
||||
| (int, int) - (width, height) | default_element_size | size in characters (wide) and rows (high) for all elements in this window |
|
||||
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
|
||||
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
|
||||
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
|
||||
| (int, int) | relative_location | (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
|
||||
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
|
||||
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
|
||||
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |
|
||||
| (int, int) | margins | (left/right, top/bottom) Amount of pixels to leave inside the window's frame around the edges before your elements are shown. |
|
||||
| (str, str) or str | button_color | Default button colors for all buttons in the window |
|
||||
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
|
||||
| (str, str) | progress_bar_color | (bar color, background color) Sets the default colors for all progress bars in the window |
|
||||
| str | background_color | color of background |
|
||||
| int | border_depth | Default border depth (width) for all elements in the window |
|
||||
| bool | auto_close | If True, the window will automatically close itself |
|
||||
| int | auto_close_duration | Number of seconds to wait before closing the window |
|
||||
| (str or bytes) | icon | Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's |
|
||||
| bool | force_toplevel | If True will cause this window to skip the normal use of a hidden master window |
|
||||
| float | alpha_channel | Sets the opacity of the window. 0 = invisible 1 = completely visible. Values bewteen 0 & 1 will produce semi-transparent windows in SOME environments (The Raspberry Pi always has this value at 1 and cannot change. |
|
||||
| bool | return_keyboard_events | if True key presses on the keyboard will be returned as Events from Read calls |
|
||||
| bool | use_default_focus | If True will use the default focus algorithm to set the focus to the "Correct" element |
|
||||
| 'left' or 'right' or 'center' | text_justification | Default text justification for all Text Elements in window |
|
||||
| bool | no_titlebar | If true, no titlebar nor frame will be shown on window. This means you cannot minimize the window and it will not show up on the taskbar |
|
||||
| bool | grab_anywhere | If True can use mouse to click and drag to move the window. Almost every location of the window will work except input fields on some systems |
|
||||
| bool | grab_anywhere_using_control | If True can use CONTROL key + left mouse mouse to click and drag to move the window. DEFAULT is TRUE. Unlike normal grab anywhere, it works on all elements. |
|
||||
| bool | keep_on_top | If True, window will be created on top of all other windows on screen. It can be bumped down if another window created with this parm |
|
||||
| bool | resizable | If True, allows the user to resize the window. Note the not all Elements will change size or location when resizing. |
|
||||
| bool | disable_close | If True, the X button in the top right corner of the window will no work. Use with caution and always give a way out toyour users |
|
||||
| bool | disable_minimize | if True the user won't be able to minimize window. Good for taking over entire screen and staying that way. |
|
||||
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
|
||||
| str | transparent_color | Any portion of the window that has this color will be completely transparent. You can even click through these spots to the window under this window. |
|
||||
| bool | debugger_enabled | If True then the internal debugger will be enabled |
|
||||
| str | right_click_menu_background_color | Background color for right click menus |
|
||||
| str | right_click_menu_text_color | Text color for right click menus |
|
||||
| str | right_click_menu_disabled_text_color | Text color for disabled right click menu items |
|
||||
| (str, str) or str or Tuple | right_click_menu_selected_colors | Text AND background colors for a selected item. Can be a Tuple OR a color string. simplified-button-color-string "foreground on background". Can be a single color if want to set only the background. Normally a tuple, but can be a simplified-dual-color-string "foreground on background". Can be a single color if want to set only the background. |
|
||||
| (str or (str, int[, str]) or None) | right_click_menu_font | Font for right click menus |
|
||||
| bool | right_click_menu_tearoff | If True then all right click menus can be torn off |
|
||||
| bool | finalize | If True then the Finalize method will be called. Use this rather than chaining .Finalize for cleaner code |
|
||||
| str | element_justification | All elements in the Window itself will have this justification 'left', 'right', 'center' are valid values |
|
||||
| str | ttk_theme | Set the tkinter ttk "theme" of the window. Default = DEFAULT_TTK_THEME. Sets all ttk widgets to this theme as their default |
|
||||
| bool | use_ttk_buttons | Affects all buttons in window. True = use ttk buttons. False = do not use ttk buttons. None = use ttk buttons only if on a Mac |
|
||||
| bool | modal | If True then this window will be the only window a user can interact with until it is closed |
|
||||
| bool | enable_close_attempted_event | If True then the window will not close when "X" clicked. Instead an event WINDOW_CLOSE_ATTEMPTED_EVENT if returned from window.read |
|
||||
| (str or None) | titlebar_background_color | If custom titlebar indicated by use_custom_titlebar, then use this as background color |
|
||||
| (str or None) | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| (str or (str, int[, str]) or None) | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| (bytes or str) | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| bool | use_custom_titlebar | If True, then a custom titlebar will be used instead of the normal titlebar |
|
||||
| float | scaling | Apply scaling to the elements in the window. Can be set on a global basis using set_options |
|
||||
| Any | metadata | User metadata that can be set to ANYTHING |
|
||||
|
||||
### add_row
|
||||
|
||||
|
@ -17459,7 +17474,8 @@ execute_command_subprocess(command,
|
|||
wait = False,
|
||||
cwd = None,
|
||||
pipe_output = False,
|
||||
merge_stderr_with_stdout = True)
|
||||
merge_stderr_with_stdout = True,
|
||||
stdin = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
@ -17472,6 +17488,7 @@ Parameter Descriptions:
|
|||
| str | cwd | Working directory to use when executing the subprocess |
|
||||
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
|
||||
| bool | merge_stderr_with_stdout | If True then output from the subprocess stderr will be merged with stdout. The result is ALL output will be on stdout. |
|
||||
| bool | stdin | Value passed to the Popen call. Defaults to subprocess.DEVNULL so that the pyinstaller created executable work correctly |
|
||||
| (subprocess.Popen) | **RETURN** | Popen object
|
||||
|
||||
Runs the editor that was configured in the global settings and opens the file to a specific line number.
|
||||
|
|
|
@ -3496,9 +3496,61 @@ And the window it creates looks like this:
|
|||
|
||||
# Elements
|
||||
|
||||
You will find information on Elements and all other classes and functions are located near the end of this manual. They are in 1 large section of the readme, in alphabetical order for easy lookups. This section's discussion of Elements is meant to teach you how they work. The other section has detailed call signatures and parameter definitions.
|
||||
You will find information on Elements and all other classes and functions are located in the Call Reference Tab of the documentation.
|
||||
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements.
|
||||
"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. So that it's clear when a PySimpleGUI *Element* is being referenced versus an underlying GUI Framework's *Widget*. PySimpleGUI Elements map to a GUI Framework Widget, usually in a 1-to-1 manner. For example, a Text Element is implemented in tkinter using a Label Widget.
|
||||
|
||||
## Table of Elements in Tkinter Port
|
||||
|
||||
Each port of PySimpleGUI has a core set of Elements as well as port-specific elements. Some port-specific elements include the Dial element in the Qt port, and the Pane element in the tkinter port.
|
||||
|
||||
| Element Name | Aliases | tkinter Widget | Description |
|
||||
| :------------------ | :----------------------------- | :------------- | :------------------------ |
|
||||
| Text | T, Txt | tk.Label | One or more lines of Text |
|
||||
| Input | I, In, InputText | tk.Entry | Single line text input |
|
||||
| Combo | DD, Drop, DropDown, InputCombo | | |
|
||||
| OptionMenu | InputOptionMenu | | |
|
||||
| Multiline | ML, MLine | | |
|
||||
| Output | | | |
|
||||
| Radio | R, Rad | | |
|
||||
| Checkbox | CB, CBox, Check | | |
|
||||
| Spin | Sp | | |
|
||||
| Button | B, Btn | | |
|
||||
| Image | Im | | |
|
||||
| Canvas | | | |
|
||||
| Column | Col | | |
|
||||
| Frame | Fr | | |
|
||||
| Tab | | | |
|
||||
| TabGroup | | | |
|
||||
| Pane | | | |
|
||||
| Graph | G | | |
|
||||
| Slider | Sl | | |
|
||||
| Listbox | LB, LBox | | |
|
||||
| Menu | MenuBar, Menubar | | |
|
||||
| MenubarCustom | | | |
|
||||
| ButtonMenu | BM, BMenu | | |
|
||||
| Titlebar | | | |
|
||||
| ProgressBar | PBar, Prog, Progress | | |
|
||||
| Table | | | |
|
||||
| Tree | | | |
|
||||
| VerticalSeparator | VSep, VSeparator | | |
|
||||
| HorizontalSeparator | HSep, HSeparator | | |
|
||||
| StatusBar | SBar | | |
|
||||
| Sizegrip | SGrip | | |
|
||||
| Push | P, Stretch | | |
|
||||
| VPush | VP, VStretch | | |
|
||||
| Sizer | | | |
|
||||
|
||||
## Layout Helper Functions
|
||||
|
||||
Your Window's layout is composed of lists of Elements. In addition to elements, these Layout Help Functions may also be present in a layout definition
|
||||
|
||||
| Layout Helper | Description |
|
||||
| :------------ | :---------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| pin | "Pins" an element to a location in a layout. If element transitions from invisible to visible, pin ensures element is in correct location |
|
||||
| vtop | Vertically align element or row of elements to the top of the row |
|
||||
| vbottom | Vertically align element or row of elements to the bottom of the row |
|
||||
| vcenter | Vertically align element or row of elements to the center of the row |
|
||||
|
||||
- Text
|
||||
- Single Line Input
|
||||
|
@ -3510,29 +3562,6 @@ You will find information on Elements and all other classes and functions are lo
|
|||
- Read window
|
||||
- Close window ("Button" & all shortcut buttons)
|
||||
- Realtime
|
||||
- Checkboxes
|
||||
- Radio Buttons
|
||||
- Listbox
|
||||
- Slider
|
||||
- Multi-line Text Input/Output
|
||||
- Multi-line Text Output (not on tkinter version)
|
||||
- Scroll-able Output
|
||||
- Vertical Separator
|
||||
- Progress Bar
|
||||
- Option Menu
|
||||
- Menu
|
||||
- ButtonMenu
|
||||
- Frame
|
||||
- Column
|
||||
- Graph
|
||||
- Image
|
||||
- Table
|
||||
- Tree
|
||||
- Tab, TabGroup
|
||||
- StatusBar
|
||||
- Pane
|
||||
- Stretch (Qt only)
|
||||
- Sizer (plain PySimpleGUI only)
|
||||
|
||||
## Keys
|
||||
|
||||
|
@ -5568,29 +5597,159 @@ You can also set the cursor for the Window as a whole, including the margins and
|
|||
|
||||
## Valid Cursor Strings
|
||||
|
||||
`X_cursor, arrow, based_arrow_down, based_arrow_up, boat, bogosity, bottom_left_corner, bottom_right_corner, bottom_side, bottom_tee, box_spiral, center_ptr, circle, clock, coffee_mug, cross, cross_reverse, crosshair, diamond_cross, dot, dotbox, double_arrow, draft_large, draft_small, draped_box, exchange, fleur, gobbler, gumby, hand1, hand2, heart, icon, iron_cross, left_ptr, left_side, left_tee, leftbutton, ll_angle, lr_angle, man, middlebutton, mouse, pencil, pirate, plus, question_arrow, right_ptr, right_side, right_tee, rightbutton, rtl_logo, sailboat, sb_down_arrow, sb_h_double_arrow, sb_left_arrow, sb_right_arrow, sb_up_arrow, sb_v_double_arrow, shuttle, sizing, spider, spraycan, star, target, tcross, top_left_arrow, top_left_corner, top_right_corner, top_side, top_tee, trek, ul_angle, umbrella, ur_angle, watch, xterm`
|
||||
```
|
||||
X_cursor
|
||||
arrow
|
||||
based_arrow_down
|
||||
based_arrow_up
|
||||
boat
|
||||
bogosity
|
||||
bottom_left_corner
|
||||
bottom_right_corner
|
||||
bottom_side
|
||||
bottom_tee
|
||||
box_spiral
|
||||
center_ptr
|
||||
circle
|
||||
clock
|
||||
coffee_mug
|
||||
cross
|
||||
cross_reverse
|
||||
crosshair
|
||||
diamond_cross
|
||||
dot
|
||||
dotbox
|
||||
double_arrow
|
||||
draft_large
|
||||
draft_small
|
||||
draped_box
|
||||
exchange
|
||||
fleur
|
||||
gobbler
|
||||
gumby
|
||||
hand1
|
||||
hand2
|
||||
heart
|
||||
icon
|
||||
iron_cross
|
||||
left_ptr
|
||||
left_side
|
||||
left_tee
|
||||
leftbutton
|
||||
ll_angle
|
||||
lr_angle
|
||||
man
|
||||
middlebutton
|
||||
mouse
|
||||
pencil
|
||||
pirate
|
||||
plus
|
||||
question_arrow
|
||||
right_ptr
|
||||
right_side
|
||||
right_tee
|
||||
rightbutton
|
||||
rtl_logo
|
||||
sailboat
|
||||
sb_down_arrow
|
||||
sb_h_double_arrow
|
||||
sb_left_arrow
|
||||
sb_right_arrow
|
||||
sb_up_arrow
|
||||
sb_v_double_arrow
|
||||
shuttle
|
||||
sizing
|
||||
spider
|
||||
spraycan
|
||||
star
|
||||
target
|
||||
tcross
|
||||
top_left_arrow
|
||||
top_left_corner
|
||||
top_right_corner
|
||||
top_side
|
||||
top_tee
|
||||
trek
|
||||
ul_angle
|
||||
umbrella
|
||||
ur_angle
|
||||
watch
|
||||
xterm
|
||||
|
||||
```
|
||||
|
||||
## No Cursor
|
||||
|
||||
To specify no cursor should be shown, the cursor `'no'` can be used on some platforms
|
||||
If you want your mouse cursor to be invisible, then use the **string** `"none"` and your element or window will not show any cursor.
|
||||
|
||||
## Windows OS Specific
|
||||
|
||||
One windows, these cursors map to native Windows cursors:
|
||||
|
||||
`arrow, center_ptr, crosshair, fleur, ibeam, icon, sb_h_double_arrow, sb_v_double_arrow, watch, xterm`
|
||||
```
|
||||
arrow
|
||||
center_ptr
|
||||
crosshair
|
||||
fleur
|
||||
ibeam
|
||||
icon
|
||||
sb_h_double_arrow
|
||||
sb_v_double_arrow
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
And these are also available:
|
||||
These are also available:
|
||||
|
||||
`no, starting, size, size_ne_sw, size_ns, size_nw_se, size_we, uparrow, wait`
|
||||
```
|
||||
no
|
||||
starting
|
||||
size
|
||||
size_ne_sw
|
||||
size_ns
|
||||
size_nw_se
|
||||
size_we
|
||||
uparrow
|
||||
wait
|
||||
```
|
||||
|
||||
## Mac OS Specific
|
||||
|
||||
`arrow, cross, crosshair, ibeam, plus, watch, xterm`
|
||||
```
|
||||
arrow
|
||||
cross
|
||||
crosshair
|
||||
ibeam
|
||||
plus
|
||||
watch
|
||||
xterm
|
||||
```
|
||||
|
||||
And these additional native cursors are available for the Mac
|
||||
These additional native cursors are available for the Mac
|
||||
|
||||
`copyarrow, aliasarrow, contextualmenuarrow, text, cross-hair, closedhand, openhand, pointinghand, resizeleft, resizeright, resizeleftright, resizeup, resizedown, resizeupdown, none, notallowed, poof, countinguphand, countingdownhand, countingupanddownhand, spinning`
|
||||
```
|
||||
copyarrow
|
||||
aliasarrow
|
||||
contextualmenuarrow
|
||||
text
|
||||
cross-hair
|
||||
closedhand
|
||||
openhand
|
||||
pointinghand
|
||||
resizeleft
|
||||
resizeright
|
||||
resizeleftright
|
||||
resizeup
|
||||
resizedown
|
||||
resizeupdown
|
||||
none
|
||||
notallowed
|
||||
poof
|
||||
countinguphand
|
||||
countingdownhand
|
||||
countingupanddownhand
|
||||
spinning
|
||||
```
|
||||
|
||||
# Keyboard & Mouse Capture
|
||||
|
||||
|
|
Loading…
Reference in New Issue