MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / __init__

Method __init__

PySimpleGUI/PySimpleGUI.py:4780–4941  ·  view source on GitHub ↗

:param button_text: Text to be displayed on the button :type button_text: (str) :param button_type: You should NOT be setting this directly. ONLY the shortcut functions set this :type button_type: (int) :param target

(self, button_text='', button_type=BUTTON_TYPE_READ_FORM, target=(None, None), tooltip=None,
                 file_types=FILE_TYPES_ALL_FILES, initial_folder=None, default_extension='', disabled=False, change_submits=False,
                 enable_events=False, image_filename=None, image_data=None, image_size=(None, None),
                 image_subsample=None, image_zoom=None, image_source=None, border_width=None, size=(None, None), s=(None, None), auto_size_button=None, button_color=None,
                 disabled_button_color=None,
                 highlight_colors=None, mouseover_colors=(None, None), use_ttk_buttons=None, font=None, bind_return_key=False, focus=False, pad=None, p=None, key=None,
                 k=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None)

Source from the content-addressed store, hash-verified

4778 """
4779
4780 def __init__(self, button_text='', button_type=BUTTON_TYPE_READ_FORM, target=(None, None), tooltip=None,
4781 file_types=FILE_TYPES_ALL_FILES, initial_folder=None, default_extension='', disabled=False, change_submits=False,
4782 enable_events=False, image_filename=None, image_data=None, image_size=(None, None),
4783 image_subsample=None, image_zoom=None, image_source=None, border_width=None, size=(None, None), s=(None, None), auto_size_button=None, button_color=None,
4784 disabled_button_color=None,
4785 highlight_colors=None, mouseover_colors=(None, None), use_ttk_buttons=None, font=None, bind_return_key=False, focus=False, pad=None, p=None, key=None,
4786 k=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None):
4787 """
4788 :param button_text: Text to be displayed on the button
4789 :type button_text: (str)
4790 :param button_type: You should NOT be setting this directly. ONLY the shortcut functions set this
4791 :type button_type: (int)
4792 :param target: key or (row,col) target for the button. Note that -1 for column means 1 element to the left of this one. The constant ThisRow is used to indicate the current row. The Button itself is a valid target for some types of button
4793 :type target: str | (int, int)
4794 :param tooltip: text, that will appear when mouse hovers over the element
4795 :type tooltip: (str)
4796 :param file_types: the filetypes that will be used to match files. To indicate all files: (("ALL Files", "*.* *"),).
4797 :type file_types: Tuple[(str, str), ...]
4798 :param initial_folder: starting path for folders and files
4799 :type initial_folder: (str)
4800 :param default_extension: If no extension entered by user, add this to filename (only used in saveas dialogs)
4801 :type default_extension: (str)
4802 :param disabled: If True button will be created disabled. If BUTTON_DISABLED_MEANS_IGNORE then the button will be ignored rather than disabled using tkinter
4803 :type disabled: (bool | str)
4804 :param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
4805 :type change_submits: (bool)
4806 :param enable_events: Turns on the element specific events. If this button is a target, should it generate an event when filled in
4807 :type enable_events: (bool)
4808 :param image_source: Image to place on button. Use INSTEAD of the image_filename and image_data. Unifies these into 1 easier to use parm
4809 :type image_source: (str | bytes)
4810 :param image_filename: image filename if there is a button image. GIFs and PNGs only.
4811 :type image_filename: (str)
4812 :param image_data: Raw or Base64 representation of the image to put on button. Choose either filename or data
4813 :type image_data: bytes | str
4814 :param image_size: Size of the image in pixels (width, height)
4815 :type image_size: (int, int)
4816 :param image_subsample: amount to reduce the size of the image. Divides the size by this number. 2=1/2, 3=1/3, 4=1/4, etc
4817 :type image_subsample: (int)
4818 :param image_zoom: amount to increase the size of the image. 2=twice size, 3=3 times, etc
4819 :type image_zoom: (int)
4820 :param border_width: width of border around button in pixels
4821 :type border_width: (int)
4822 :param size: (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
4823 :type size: (int | None, int | None) | (None, None) | int
4824 :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
4825 :type s: (int | None, int | None) | (None, None) | int
4826 :param auto_size_button: if True the button size is sized to fit the text
4827 :type auto_size_button: (bool)
4828 :param button_color: Color of button. default is from theme or the window. Easy to remember which is which if you say "ON" between colors. "red" on "green". Normally a tuple, but can be a simplified-button-color-string "foreground on background". Can be a single color if want to set only the background.
4829 :type button_color: (str, str) | str
4830 :param disabled_button_color: colors to use when button is disabled (text, background). Use None for a color if don't want to change. Only ttk buttons support both text and background colors. tk buttons only support changing text color
4831 :type disabled_button_color: (str, str) | str
4832 :param highlight_colors: colors to use when button has focus (has focus, does not have focus). None will use colors based on theme. Only used by Linux and only for non-TTK button
4833 :type highlight_colors: (str, str)
4834 :param mouseover_colors: Important difference between Linux & Windows! Linux - Colors when mouse moved over button. Windows - colors when button is pressed. The default is to switch the text and background colors (an inverse effect)
4835 :type mouseover_colors: (str, str) | str
4836 :param use_ttk_buttons: True = use ttk buttons. False = do not use ttk buttons. None (Default) = use ttk buttons only if on a Mac and not with button images
4837 :type use_ttk_buttons: (bool)

Callers

nothing calls this directly

Calls 5

button_color_to_tupleFunction · 0.85
running_macFunction · 0.85
theme_button_colorFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected