MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / Frame

Class Frame

PySimpleGUI/PySimpleGUI.py:6904–7130  ·  view source on GitHub ↗

A Frame Element that contains other Elements. Encloses with a line around elements and a text label.

Source from the content-addressed store, hash-verified

6902# Frame #
6903# ---------------------------------------------------------------------- #
6904class Frame(Element):
6905 """
6906 A Frame Element that contains other Elements. Encloses with a line around elements and a text label.
6907 """
6908
6909 def __init__(self, title, layout, title_color=None, background_color=None, title_location=None,
6910 relief=DEFAULT_FRAME_RELIEF, size=(None, None), s=(None, None), font=None, pad=None, p=None, border_width=None, border_width_no_relief=None, border_color=None, key=None, k=None,
6911 tooltip=None, right_click_menu=None, expand_x=False, expand_y=False, grab=None, visible=True, element_justification='left', vertical_alignment=None,
6912 metadata=None):
6913 """
6914 :param title: text that is displayed as the Frame's "label" or title
6915 :type title: (str)
6916 :param layout: The layout to put inside the Frame
6917 :type layout: List[List[Elements]]
6918 :param title_color: color of the title text
6919 :type title_color: (str)
6920 :param background_color: background color of the Frame
6921 :type background_color: (str)
6922 :param title_location: location to place the text title. Choices include: TITLE_LOCATION_TOP TITLE_LOCATION_BOTTOM TITLE_LOCATION_LEFT TITLE_LOCATION_RIGHT TITLE_LOCATION_TOP_LEFT TITLE_LOCATION_TOP_RIGHT TITLE_LOCATION_BOTTOM_LEFT TITLE_LOCATION_BOTTOM_RIGHT
6923 :type title_location: (str)
6924 :param relief: relief style. Values are same as other elements with reliefs. Choices include RELIEF_RAISED RELIEF_SUNKEN RELIEF_FLAT RELIEF_RIDGE RELIEF_GROOVE RELIEF_SOLID
6925 :type relief: (str)
6926 :param size: (width, height) Sets an initial hard-coded size for the Frame. This used to be a problem, but was fixed in 4.53.0 and works better than Columns when using the size paramter
6927 :type size: (int, int)
6928 :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
6929 :type s: (int, int) | (None, None) | int
6930 :param font: specifies the font family, size, etc. for the TITLE. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
6931 :type font: (str or (str, int[, str]) or None)
6932 :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)
6933 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
6934 :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
6935 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
6936 :param border_width: width of border around element in pixels (used with the frame's relief)
6937 :type border_width: (int)
6938 :param border_color: Custom color of the border around frame. Set by system if using a relief. Use border_width_no_relief with border_color to get a custom frame color. defaults to text elem color
6939 :type border_color: (str)
6940 :param border_width_no_relief: width of border around element in pixels. This is used without a relief. border_width should be 0 if this parm is non-zero
6941 :type border_width_no_relief: (int)
6942 :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
6943 :type key: str | int | tuple | object
6944 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
6945 :type k: str | int | tuple | object
6946 :param tooltip: text, that will appear when mouse hovers over the element
6947 :type tooltip: (str)
6948 :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
6949 :type right_click_menu: List[List[ List[str] | str ]]
6950 :param expand_x: If True the element will automatically expand in the X direction to fill available space
6951 :type expand_x: (bool)
6952 :param expand_y: If True the element will automatically expand in the Y direction to fill available space
6953 :type expand_y: (bool)
6954 :param grab: If True can grab this element and move the window around. Default is False
6955 :type grab: (bool)
6956 :param visible: set visibility state of the element
6957 :type visible: (bool)
6958 :param element_justification: All elements inside the Frame will have this justification 'left', 'right', 'center' are valid values
6959 :type element_justification: (str)
6960 :param vertical_alignment: Place the Frame at the 'top', 'center', 'bottom' of the row (can also use t,c,r). Defaults to no setting (tkinter decides)
6961 :type vertical_alignment: (str)

Callers 4

theme_previewerFunction · 0.85
_create_main_windowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected