MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / Input

Class Input

PySimpleGUI/PySimpleGUI.py:1966–2217  ·  view source on GitHub ↗

Display a single text input field. Based on the tkinter Widget `Entry`

Source from the content-addressed store, hash-verified

1964# Input Class #
1965# ---------------------------------------------------------------------- #
1966class Input(Element):
1967 """
1968 Display a single text input field. Based on the tkinter Widget `Entry`
1969 """
1970
1971 def __init__(self, default_text='', size=(None, None), s=(None, None), disabled=False, password_char='', setting=None,
1972 justification=None, background_color=None, text_color=None, font=None, tooltip=None, border_width=None,
1973 change_submits=False, enable_events=False, do_not_clear=True, key=None, k=None, focus=False, pad=None, p=None,
1974 use_readonly_for_disable=True, readonly=False, disabled_readonly_background_color=None, disabled_readonly_text_color=None, selected_text_color=None,
1975 selected_background_color=None, expand_x=False, expand_y=False,
1976 right_click_menu=None, visible=True, metadata=None):
1977 """
1978 :param default_text: Text initially shown in the input box as a default value(Default value = ''). Will automatically be converted to string
1979 :type default_text: (Any)
1980 :param size: w=characters-wide, h=rows-high. If an int is supplied rather than a tuple, then a tuple is created width=int supplied and heigh=1
1981 :type size: (int, int) | (int, None) | int
1982 :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
1983 :type s: (int, int) | (None, None) | int
1984 :param disabled: set disable state for element (Default = False)
1985 :type disabled: (bool)
1986 :param password_char: Password character if this is a password field (Default value = '')
1987 :type password_char: (char)
1988 :param setting: If not None, then this element will be saved in a settings file using the key for the element
1989 :type setting: (Any)
1990 :param justification: justification for data display. Valid choices - left, right, center
1991 :type justification: (str)
1992 :param background_color: color of background in one of the color formats
1993 :type background_color: (str)
1994 :param text_color: color of the text
1995 :type text_color: (str)
1996 :param font: specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
1997 :type font: (str or (str, int[, str]) or None)
1998 :param tooltip: text, that will appear when mouse hovers over the element
1999 :type tooltip: (str)
2000 :param border_width: width of border around element in pixels
2001 :type border_width: (int)
2002 :param change_submits: * DEPRICATED DO NOT USE. Use `enable_events` instead
2003 :type change_submits: (bool)
2004 :param enable_events: If True then changes to this element are immediately reported as an event. Use this instead of change_submits (Default = False)
2005 :type enable_events: (bool)
2006 :param do_not_clear: If False then the field will be set to blank after ANY event (button, any event) (Default = True)
2007 :type do_not_clear: (bool)
2008 :param 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
2009 :type key: str | int | tuple | object
2010 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
2011 :type k: str | int | tuple | object
2012 :param focus: Determines if initial focus should go to this element.
2013 :type focus: (bool)
2014 :param pad: Amount of padding to put around element. Normally (horizontal pixels, vertical pixels) but can be split apart further into ((horizontal left, horizontal right), (vertical above, vertical below)). If int is given, then converted to tuple (int, int) with the value provided duplicated
2015 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
2016 :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
2017 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
2018 :param use_readonly_for_disable: If True (the default) tkinter state set to 'readonly'. Otherwise state set to 'disabled'
2019 :type use_readonly_for_disable: (bool)
2020 :param readonly: If True tkinter state set to 'readonly'. Use this in place of use_readonly_for_disable as another way of achieving readonly. Note cannot set BOTH readonly and disabled as tkinter only supplies a single flag
2021 :type readonly: (bool)
2022 :param disabled_readonly_background_color: If state is set to readonly or disabled, the color to use for the background
2023 :type disabled_readonly_background_color: (str)

Callers 3

_choose_auto_watchesMethod · 0.85
_create_main_windowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected