Reference 〉Class

expandableFrame( tkinter.Frame parent = None, str text = '', str fg = '#333', str bg = '#FFF', int padx = 8, int pady = None, tuple(str,int) font = None, bool startOpen = True )

A container for GUI elements similar to tkinter.Frame, but the contents are collapsible by clicking on the title. Used for sections of the control panel.

This class inherits from tkinter.Frame and will contain all the methods and properties of that class as well. These are not listed here.

Initialization Parameters

  • parent tkinter.Frame, optional

    The Tkinter frame to which the expandable frame should be attached.

    Default value: None

  • text str, optional

    The title of the frame, clickable to expand and collapse.

    Default value: ''

  • fg str, optional

    A hex value for the text color.

    Default value: '#333'

  • bg str, optional

    A hex value for the background color.

    Default value: '#FFF'

  • padx int, optional

    The container frame's horizontal padding.

    Default value: 8

  • pady int, optional

    The container frame's vertical padding.

    Default value: None

  • font tuple(str,int), optional

    A font name/size pair.

    Default value: None

  • startOpen bool, optional

    If True, the frame is drawn expanded initially. If False, the frame is drawn collapsed initially.

    Default value: True

Methods

Click a method name for more detailed documentation.

  • toggle( )

    Expands a collapsed frame, and collapses an expanded frame.

    Note that the function signature takes one optional argument, a Tkinter event string, in order to be used as a callback for a click event. This argument is not used in the function.

Properties

  • padx int

    The container frame's horizontal padding.

  • pady int

    The container frame's vertical padding.

  • text str

    The title of the expandable frame.

  • titleLabel tkinter.Label

    The Tkinter Label element corresponding to the clickable title.

  • open tkinter.IntVar

    Whether the frame is expanded or collapsed. Use expandableFrame.open.get() to get a bool value.

    Initial value: IntVar(True)

  • subframe tkinter.Frame

    The Tkinter Frame element that gets expanded and collapsed. Can be interacted with and have elements placed into it like any Frame element.

    Initial value:

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.