Containers

Group

Box

A box to put items into.

Tabs

A tabbed view.

VerticalSplits

An arrangement of flexible width panes separated by vertical dividers.

HorizontalSplits

An arrangement of flexible width panes separated by horizontal dividers.

ScrollView

Not yet implemented.

VerticalStack

A vertical stack of items.

ScrollingVerticalStack

A scrollable vertical stack.

HorizontalStack

A horizontal stack of items.

Accordion

A closable pane with a title and content.

Grid

A grid of items.

ScrollingGrid

A scrollable grid.

ImageButtonGrid

A grid of image buttons.

Group

class ezui.Group
getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

show(onOff)

Show or hide the object.

onOff A boolean value representing if the object should be shown or not.

enable(onOff)

Enable or disable the object. onOff should be a boolean.

setItemsEnabled(state)

Set the enabled state for all items within the container.

Box

class ezui.Box

A box to put items into. Box usage reference.

To create a Box with a text description, use the item type name token * Box.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        * Box
        > (Button 1)
        > (Button 2)
        > (Button 3)
        """
        self.w = ezui.EZWindow(
            title="Demo",
            size=(200, 200),
            content=content,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/Box_class_1.png
import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        * Box
        # all containers have a vertical stack
        # as their default content type
        > (Button 1)
        > (Button 2)
        > * HorizontalStack
        >> (Button 3)
        >> (Button 4)
        >> * Box
        >>> (Button 5)
        > (Button 6)
        """
        descriptionData = dict()
        self.w = ezui.EZWindow(
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/Box_class_2.png

Description Data

content A description of the content to display in the box.

title A title to display on the box. Optional.

margins The margins to inset the items from the frame of the box. This can be an integer or tuple of (x, y) integers. Optional.

drawBackground If the background is drawn. Optional.

backgroundColor The background color. A NSColor or (r, g, b, a) tuple. Optional.

borderColor The border color. A NSColor or (r, g, b, a) tuple. Optional.

borderWidth The border width. Optional.

cornerRadius The corner radius of the box. Optional.

Warning

backgroundColor, borderColor, borderWidth and cornerRadius should not be used for anything other than debugging unless you have a really good reason to use them.

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

Tabs

class ezui.Tabs

A tabbed view. Tabs usage reference.

To create Tabs with a text description, use the item type name token * Tabs.

To define a tab, use * Tab: followed by the text you want to be displayed in the tab button.

To define the content of a tab, add a > nest indicator for each item you want to display in the tab. The default container type for a tab is VerticalStack. To change the container type, follow the name of the tab with = ContainerType with ContainerType being the name of the container type you want to use.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = Tabs
        * Tab: One @tab1
        > This is tab one.
        * Tab: Two @tab2
        > This
        > is
        > tab
        > two.
        * Tab: Three = HorizontalStack @tab3
        > This
        > is
        > tab
        > three.
        """
        self.w = ezui.EZWindow(
            title="Demo",
            content=content,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/Tabs_class_1.png

Description Data

contents A list of tab definition dictionaries. These have the following form:

key

value

"identifier"

The unique identifier for the tab.

"text"

The title for the tab.

Optional.

"content"

A description of the content of the tab.

Optional.

margins The margins between the edge of the tab and the tab contents. This can be an integer indicating the margin on all sides, a tuple of two integers indicating the (x, y) margins or a tuple of four integers indicating the (left, bottom, right, top) margins. Optional.

showButtons If the tab buttons should be visible. Optional.

callback The function to call when a tab is selected.

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getTab(identifier)

Get a specific tab.

setSelectedTab(identifier)

Set the selected tab.

getSelectedTab()

Get the selected tab.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

VerticalSplits

class ezui.VerticalSplits

An arrangement of flexible width panes separated by vertical dividers.

Splits usage reference.

To create a VerticalSplits with a text description, use the item type name token * VerticalSplits. To define the contents, add a > nest indicator for each item you want to display in the splits.

To define a pane, use * SplitsPane.

To define the content of a pane, add a > nest indicator for each item you want to display in the pane. The default container type for a pane is VerticalStack. To change the container type, follow VerticalSplits with = ContainerType with ContainerType being the name of the container type you want to use.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = VerticalSplits

        * SplitsPane    @pane1
        > [[_One_]]     @editor1

        * SplitsPane    @pane2
        > [[_Two_]]     @editor2

        * SplitsPane    @pane3
        > [[_Three_]]   @editor3

        =============

        (Toggle)        @toggleButton
        """
        descriptionData = dict(
            pane1=dict(
                preferredThickness=100,
                minThickness=50,
                maxThickness=200,
                priority=101
            ),
            pane2=dict(
                preferredThickness=200,
                minThickness=150,
                priority=100
            ),
            pane3=dict(
                preferredThickness=100,
                minThickness=75,
                canCollapse=True,
                priority=102
            ),
            editor1=dict(
                height="fill"
            ),
            editor2=dict(
                height="fill"
            ),
            editor3=dict(
                height="fill"
            )
        )
        self.w = ezui.EZWindow(
            title="Demo",
            content=content,
            descriptionData=descriptionData,
            controller=self,
            size=("auto", 200),
            minSize=(100, 100),
        )

    def started(self):
        self.w.open()

    def toggleButtonCallback(self, sender):
        pane = self.w.getItem("pane3")
        pane.toggle()

DemoController()
_images/VerticalSplits_class_1.png

Description Data

contents A list of item descriptions. These have the following form:

key

value

"identifier"

The unique identifier for the pane.

Optional.

"minThickness"

An integer representing the minimum thickness of the pane.

Optional.

"maxThickness"

An integer representing the maximum thickness of the pane.

Optional.

"preferredThickness"

An integer representing the preferred thickness of the pane.

Optional.

"canCollapse"

If the pane can collapse. The default is False.

Optional.

"collapsed"

A boolean representing if the pane is initially collapsed. The default is False.

Optional.

"priority"

An integer between 0 and 1000 indicating the resize priority for this pane. The pane with the lowest value will be resized before other panes.

Optional.

dividerColor A NSColor or (r, g, b, a) tuple that the divider should be drawn with. Optional.

dividerThickness The thickness of the divider. See Apple’s recommendations on when changing from the default thickness is recommended. (It’s not recommended often if at all.) Optional.

autosaveName An identifier for this split view. This will be used to store the pane sized in the application preferences. Optional.

resizeCallback The function to call when the panes are resized. Optional.

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

HorizontalSplits

class ezui.HorizontalSplits

An arrangement of flexible width panes separated by horizontal dividers.

Splits usage reference.

To create a HorizontalSplits with a text description, use the item type name token * HorizontalSplits. To define the contents, add a > nest indicator for each item you want to display in the splits.

To define a pane, use * SplitsPane.

To define the content of a pane, add a > nest indicator for each item you want to display in the pane. The default container type for a pane is VerticalStack. To change the container type, follow HorizontalSplits with = ContainerType with ContainerType being the name of the container type you want to use.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = HorizontalSplits

        * SplitsPane    @pane1
        > [[_One_]]     @editor1

        * SplitsPane    @pane2
        > [[_Two_]]     @editor2

        * SplitsPane    @pane3
        > [[_Three_]]   @editor3

        =============

        (Toggle)        @toggleButton
        """
        descriptionData = dict(
            pane1=dict(
                preferredThickness=100,
                minThickness=50,
                maxThickness=200,
                priority=101
            ),
            pane2=dict(
                preferredThickness=200,
                minThickness=150,
                priority=100
            ),
            pane3=dict(
                preferredThickness=100,
                minThickness=75,
                canCollapse=True,
                priority=102
            ),
            editor1=dict(
                width="fill",
                height="fill"
            ),
            editor2=dict(
                width="fill",
                height="fill"
            ),
            editor3=dict(
                width="fill",
                height="fill"
            )
        )
        self.w = ezui.EZWindow(
            title="Demo",
            content=content,
            descriptionData=descriptionData,
            controller=self,
            size=(200, "auto"),
            minSize=(100, 100),
        )

    def started(self):
        self.w.open()

    def toggleButtonCallback(self, sender):
        pane = self.w.getItem("pane3")
        pane.toggle()

DemoController()
_images/HorizontalSplits_class_1.png

Description Data

contents A list of item descriptions. These have the following form:

key

value

"identifier"

The unique identifier for the pane.

Optional.

"minThickness"

An integer representing the minimum thickness of the pane.

Optional.

"maxThickness"

An integer representing the maximum thickness of the pane.

Optional.

"preferredThickness"

An integer representing the preferred thickness of the pane.

Optional.

"canCollapse"

If the pane can collapse. The default is False.

Optional.

"collapsed"

A boolean representing if the pane is initially collapsed. The default is False.

Optional.

"priority"

An integer between 0 and 1000 indicating the resize priority for this pane. The pane with the lowest value will be resized before other panes.

Optional.

dividerColor A NSColor or (r, g, b, a) tuple that the divider should be drawn with. Optional.

dividerThickness The thickness of the divider. See Apple’s recommendations on when changing from the default thickness is recommended. (It’s not recommended often if at all.) Optional.

autosaveName An identifier for this split view. This will be used to store the pane sized in the application preferences. Optional.

resizeCallback The function to call when the panes are resized. Optional.

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

ScrollView

class ezui.ScrollView

Not yet implemented. ScrollView usage reference.

VerticalStack

class ezui.VerticalStack

A vertical stack of items.

To create a VerticalStack with a text description, use the item type name token * VerticalStack. To define the contents, add a > nest indicator for each item you want to display in the stack.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = VerticalStack
        X---------- @slider0
        -X--------- @slider1
        --X-------- @slider2
        ---X------- @slider3
        ----X------ @slider4
        -----X----- @slider5
        ------X---- @slider6
        -------X--- @slider7
        --------X-- @slider8
        ---------X- @slider9
        ----------X @slider10
        """
        descriptionData = dict(
            slider0=dict(value=0),
            slider1=dict(value=10),
            slider2=dict(value=20),
            slider3=dict(value=30),
            slider4=dict(value=40),
            slider5=dict(value=50),
            slider6=dict(value=60),
            slider7=dict(value=70),
            slider8=dict(value=80),
            slider9=dict(value=90),
            slider10=dict(value=100)
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(200, "auto"),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/VerticalStack_class_1.png

Description Data

contents A list of item descriptions. These have the following form:

key

value

"identifier"

The unique identifier for the item.

Optional.

"item"

An instantiated vanilla object. If given, the rest of the item definition will be ignored.

Optional.

"width"

The width of the item. This can be an integer, "auto" (the default), "fit" indicating that the item should be fit to its content or "fill" indicating that the width of the item should be the width of the stack. See example below.

Optional.

"height"

The height of the item. Heights should only be set when an item doesn’t have a standard height.

Optional.

"bottomPadding"

A value to add to spacing after the item.

Optional.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = VerticalStack
        (default)  @defaultItem
        (fit)      @fitItem
        (fill)     @fillItem
        (100)      @intItem
        """
        descriptionData = dict(
            defaultItem=dict(
                # defaults
            ),
            fitItem=dict(
                width="fit"
            ),
            fillItem=dict(
                width="fill"
            ),
            intItem=dict(
                width=100
            )
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(200, "auto"),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()

spacing The spacing to put between items.

margins The margins between the edge of the stack and the stack contents. This can be an integer indicating the margin on all sides, a tuple of two integers indicating the (x, y) margins or a tuple of four integers indicating the (left, bottom, right, top) margins. Optional.

distribution The vertical distribution of the items within the stack. Options:

  • "auto"

  • "equalCentering"

  • "equalSpacing"

  • "fill"

  • "fillEqually"

  • "fillProportionally"

  • "gravity"

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = Tabs
        * Tab: auto @autoTab = VerticalStack @autoStack
        > [[_ 25  _]] @auto1
        > [[_ 50  _]] @auto2
        > [[_ 100 _]] @auto3
        * Tab: equalCentering = VerticalStack @equalCenteringStack
        > [[_ 25  _]] @equalCentering1
        > [[_ 50  _]] @equalCentering2
        > [[_ 100 _]] @equalCentering3
        * Tab: equalSpacing = VerticalStack @equalSpacingStack
        > [[_ 25  _]] @equalSpacing1
        > [[_ 50  _]] @equalSpacing2
        > [[_ 100 _]] @equalSpacing3
        * Tab: fill = VerticalStack @fillStack
        > [[_ 25  _]] @fill1
        > [[_ 50  _]] @fill2
        > [[_ 100 _]] @fill3
        * Tab: fillEqually = VerticalStack @fillEquallyStack
        > [[_ 25  _]] @fillEqually1
        > [[_ 50  _]] @fillEqually2
        > [[_ 100 _]] @fillEqually3
        * Tab: fillProportionally = VerticalStack @fillProportionallyStack
        > [[_ 25  _]] @fillProportionally1
        > [[_ 50  _]] @fillProportionally2
        > [[_ 100 _]] @fillProportionally3
        * Tab: gravity = VerticalStack @gravityStack
        > [[_ 25  _]] @gravity1
        > [[_ 50  _]] @gravity2
        > [[_ 100 _]] @gravity3
        """
        descriptionData = dict(
            autoStack=dict(
                distribution="auto"
            ),
            auto1=dict(height=25),
            auto2=dict(height=50),
            auto3=dict(height=100),

            equalCenteringStack=dict(
                distribution="equalCentering"
            ),
            equalCentering1=dict(height=25),
            equalCentering2=dict(height=50),
            equalCentering3=dict(height=100),

            equalSpacingStack=dict(
                distribution="equalSpacing"
            ),
            equalSpacing1=dict(height=25),
            equalSpacing2=dict(height=50),
            equalSpacing3=dict(height=100),

            fillStack=dict(
                distribution="fill"
            ),
            fill1=dict(height=25),
            fill2=dict(height=50),
            fill3=dict(height=100),

            fillEquallyStack=dict(
                distribution="fillEqually"
            ),
            fillEqually1=dict(height=25),
            fillEqually2=dict(height=50),
            fillEqually3=dict(height=100),

            fillProportionallyStack=dict(
                distribution="fillProportionally"
            ),
            fillProportionally1=dict(height=25),
            fillProportionally2=dict(height=50),
            fillProportionally3=dict(height=100),

            gravityStack=dict(
                distribution="gravity"
            ),
            gravity1=dict(height=25),
            gravity2=dict(height=50),
            gravity3=dict(height=100),
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(650, 500),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()

alignment Where to align the items. Options:

  • "leading"

  • "center"

  • "trailing"

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

ScrollingVerticalStack

class ezui.ScrollingVerticalStack

A scrollable vertical stack. Refer to VerticalStack for options.

To create a ScrollingVerticalStack with a text description, use the item type name token * ScrollingVerticalStack. To define the contents, add a > nest indicator for each item you want to display in the stack.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = ScrollingVerticalStack
        X---------- @slider0
        -X--------- @slider1
        --X-------- @slider2
        ---X------- @slider3
        ----X------ @slider4
        -----X----- @slider5
        ------X---- @slider6
        -------X--- @slider7
        --------X-- @slider8
        ---------X- @slider9
        ----------X @slider10
        """
        descriptionData = dict(
            slider0=dict(value=0),
            slider1=dict(value=10),
            slider2=dict(value=20),
            slider3=dict(value=30),
            slider4=dict(value=40),
            slider5=dict(value=50),
            slider6=dict(value=60),
            slider7=dict(value=70),
            slider8=dict(value=80),
            slider9=dict(value=90),
            slider10=dict(value=100)
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(200, 200),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/ScrollingVerticalStack_class_1.png

HorizontalStack

class ezui.HorizontalStack

A horizontal stack of items.

To create a HorizontalStack with a text description, use the item type name token * HorizontalStack. To define the contents, add a > nest indicator for each item you want to display in the stack.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = HorizontalStack
        (One)
        (2 2 2 2 2 2 2 2)
        (Three)
        """
        self.w = ezui.EZWindow(
            title="Demo",
            content=content,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/HorizontalStack_class_1.png

Description Data

contents A list of item descriptions. These have the following form:

key

value

"identifier"

The unique identifier for the item.

Optional.

"item"

An instantiated vanilla object. If given, the rest of the item definition will be ignored.

Optional.

"width"

The width of the item. Widths should only be set when an item doesn’t have a standard width.

Optional.

"height"

The height of the item. This can be an integer, "auto" (the default), "fit" indicating that the item should be fit to its content or "fill" indicating that the height of the item should be the height of the stack. See example below.

Optional.

"bottomPadding"

A value to add to spacing after the item.

Optional.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = HorizontalStack
        * Box @defaultItem
        > default
        * Box @fitItem
        > fit
        * Box @fillItem
        > fill
        * Box @intItem
        > 100
        """
        descriptionData = dict(
            defaultItem=dict(
                # defaults
                width=100,
            ),
            fitItem=dict(
                width=100,
                height="fit"
            ),
            fillItem=dict(
                width=100,
                height="fill"
            ),
            intItem=dict(
                width=100,
                height=100
            )
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=("auto", 300),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()

spacing The spacing to put between items.

margins The margins between the edge of the stack and the stack contents. This can be an integer indicating the margin on all sides, a tuple of two integers indicating the (x, y) margins or a tuple of four integers indicating the (left, bottom, right, top) margins. Optional.

distribution The horizontal distribution of the items within the stack. Options:

  • "auto"

  • "equalCentering"

  • "equalSpacing"

  • "fill"

  • "fillEqually"

  • "fillProportionally"

  • "gravity"

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = Tabs
        * Tab: auto @autoTab = HorizontalStack @autoStack
        > [[_ 25  _]] @auto1
        > [[_ 50  _]] @auto2
        > [[_ 100 _]] @auto3
        * Tab: equalCentering = HorizontalStack @equalCenteringStack
        > [[_ 25  _]] @equalCentering1
        > [[_ 50  _]] @equalCentering2
        > [[_ 100 _]] @equalCentering3
        * Tab: equalSpacing = HorizontalStack @equalSpacingStack
        > [[_ 25  _]] @equalSpacing1
        > [[_ 50  _]] @equalSpacing2
        > [[_ 100 _]] @equalSpacing3
        * Tab: fill = HorizontalStack @fillStack
        > [[_ 25  _]] @fill1
        > [[_ 50  _]] @fill2
        > [[_ 100 _]] @fill3
        * Tab: fillEqually = HorizontalStack @fillEquallyStack
        > [[_ 25  _]] @fillEqually1
        > [[_ 50  _]] @fillEqually2
        > [[_ 100 _]] @fillEqually3
        * Tab: fillProportionally = HorizontalStack @fillProportionallyStack
        > [[_ 25  _]] @fillProportionally1
        > [[_ 50  _]] @fillProportionally2
        > [[_ 100 _]] @fillProportionally3
        * Tab: gravity = HorizontalStack @gravityStack
        > [[_ 25  _]] @gravity1
        > [[_ 50  _]] @gravity2
        > [[_ 100 _]] @gravity3
        """
        descriptionData = dict(
            autoStack=dict(
                distribution="auto"
            ),
            auto1=dict(width=25),
            auto2=dict(width=50),
            auto3=dict(width=100),

            equalCenteringStack=dict(
                distribution="equalCentering"
            ),
            equalCentering1=dict(width=25),
            equalCentering2=dict(width=50),
            equalCentering3=dict(width=100),

            equalSpacingStack=dict(
                distribution="equalSpacing"
            ),
            equalSpacing1=dict(width=25),
            equalSpacing2=dict(width=50),
            equalSpacing3=dict(width=100),

            fillStack=dict(
                distribution="fill"
            ),
            fill1=dict(width=25),
            fill2=dict(width=50),
            fill3=dict(width=100),

            fillEquallyStack=dict(
                distribution="fillEqually"
            ),
            fillEqually1=dict(width=25),
            fillEqually2=dict(width=50),
            fillEqually3=dict(width=100),

            fillProportionallyStack=dict(
                distribution="fillProportionally"
            ),
            fillProportionally1=dict(width=25),
            fillProportionally2=dict(width=50),
            fillProportionally3=dict(width=100),

            gravityStack=dict(
                distribution="gravity"
            ),
            gravity1=dict(width=25),
            gravity2=dict(width=50),
            gravity3=dict(width=100),
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(650, 200),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()

alignment Where to align the items. Options:

  • "leading"

  • "center"

  • "trailing"

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

AccordionStack

class ezui.AccordionStack

A vertical stack of accordions.

Accordion

class ezui.Accordion

A closable pane with a title and content.

To create an Accordion with a text description, use * Accordion: followed by the text you want to be displayed in the title bar.

To define the content of an accordion, add a > nest indicator for each item you want to display in the accordion. The default container type for an accordion is VerticalStack. To change the container type, follow the name of the accordion with = ContainerType with ContainerType being the name of the container type you want to use.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        * Accordion: Accordion 1 @accordion1
        > (Button 1)
        > (Button 2)
        * Accordion: Accordion 2 @accordion2
        > (Button 3)
        > (Button 4)
        """
        descriptionData = dict(
            accordion2=dict(
                closed=True
            )
        )
        self.w = ezui.EZWindow(
            title="Demo",
            size=(200, "auto"),
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/Accordion_class_1.png

Description Data

text The title of the accordion.

content The item description for the content.

contentHeight The height of the content. (optional)

closable If the accordion is closable.

closed If the accordion is closed.

getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

Grid

class ezui.Grid

A grid of items.

Warning

Grid is a work in progress. Do not use it in production code.

contents A list of row descriptions.

key

value

default

"type"

The item type. This must be "GridRow"

Required.

"contents"

A list of item descriptions.

Required.

"rowHeight"

rowHeight

Optional.

"rowPadding"

rowPadding

Optional.

"rowPlacement"

rowPlacement

Optional.

"rowAlignment"

rowAlignment

Optional.

The itemDescriptions list should contain item definition dictionaries that can be created with makeItem(). Additionally, the dictionaries may have the following key/value pairs:

key

value

default

"width"

None

Optional.

"height"

None

Optional.

"rowPlacement"

None

Optional.

"rowAlignment"

None

Optional.

"columnPlacement"

None

Optional.

rowHeight The height for rows.

rowSpacing The amount of spacing between rows.

rowPadding The (top, bottom) padding for rows.

rowPlacement The vertical placement of content within rows. Options:

  • "top"

  • "center"

  • "bottom"

  • "fill"

rowAlignment The alignment of the row. Options:

  • "firstBaseline"

  • "lastBaseline"

  • "none"

columnDescriptions An optional list of dictionaries defining column specific settings. Options:

key

value

default

"width"

width

Optional.

"columnPadding"

columnPadding

Optional.

"columnPlacement"

columnPlacement

Optional.

columnWidth The width for columns.

columnSpacing The amount of spacing between columns.

columnPadding The (left, right) padding for columns.

columnPlacement The horizontal placement of content within columns. Options:

  • "leading"

  • "center"

  • "trailing"

  • "fill"

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        button1 = dict(
            identifier="button1",
            type="PushButton",
            text="Button 1"
        )
        button2 = dict(
            identifier="button2",
            type="PushButton",
            text="Button 2"
        )
        button3 = dict(
            identifier="button3",
            type="PushButton",
            text="Button 3"
        )
        button4 = dict(
            identifier="button4",
            type="PushButton",
            text="Button 4"
        )
        button5 = dict(
            identifier="button5",
            type="PushButton",
            text="Button 5"
        )
        button6 = dict(
            identifier="button6",
            type="PushButton",
            text="Button 6"
        )
        rowDescriptions = [
            dict(
                itemDescriptions=[
                    button1,
                    button2
                ]
            ),
            dict(
                itemDescriptions=[
                    button3,
                    button4
                ]
            ),
            dict(
                itemDescriptions=[
                    button5,
                    button6
                ]
            )
        ]
        windowContent = dict(
            type="Grid",
            rowDescriptions=rowDescriptions,
            columnPlacement="fill"
        )
        windowDescription = dict(
            type="Window",
            size="auto",
            title="Grid",
            content=windowContent
        )
        self.w = ezui.makeItem(
            windowDescription,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/Grid_class_1.png
getItems(**kwargs)

Get all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

Subclasses may override this for special recursion behavior.

getItem(identifier)

Get the item with identifier contained within this container.

getItemValues()

Get the values for all items with identifiers contained within this container. This will be a dictionary with identifiers as keys and the item values as the values.

getItemValue(identifier)

Get the value for the item with identifier.

setItemValues(values)

Set the values for items. values should be a dictionary with identifiers as keys and the item values as the values.

setItemValue(identifier, value)

Set the value for the item with identifier.

ScrollingGrid

class ezui.ScrollingGrid

A scrollable grid. Refer to Grid for options.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        rowDescriptions = []
        for rowIndex in range(1, 101):
            rowDescription = dict(
                itemDescriptions=[
                    dict(
                        identifier=f"button_{rowIndex}_1",
                        type="PushButton",
                        text=f"Button {rowIndex}-1"
                    ),
                    dict(
                        identifier=f"button_{rowIndex}_2",
                        type="PushButton",
                        text=f"Button {rowIndex}-2"
                    )
                ]
            )
            rowDescriptions.append(rowDescription)
        windowContent = dict(
            type="ScrollingGrid",
            rowDescriptions=rowDescriptions,
            columnPlacement="fill"
        )
        windowDescription = dict(
            type="Window",
            size=("auto", 220),
            title="ScrollingGrid",
            content=windowContent
        )
        self.w = ezui.makeItem(
            windowDescription,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()
_images/ScrollingGrid_class_1.png

ImageButtonGrid

class ezui.ImageButtonGrid

A grid of image buttons.

drawBorders If the buttons should have borders.

contents A list of image button row descriptions.

key

value

default

"type"

The item type. This must be "ImageButtonGridRow"

Required.

"contents"

A list of :py:class:ImageButton descriptions.

Required.

symbolConfiguration A symbol configuration for symbols. See makeSymbolConfiguration() for details. Optional.

buttonSize The width and height of the button. If an integer is given, it will be used for the width and height if no value is given, the button size for the given sizeStyle will be used. Optional.

buttonSpacing The spacing between buttons. If no value is given, the button spacing for the given sizeStyle will be used. Optional.

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        * ImageButtonGrid @imageButtonGrid
        > * ImageButtonGridRow
        >> ({arrow.up.left}) @upLeftButton
        >> ({arrow.up}) @upCenterButton
        >> ({arrow.up.right}) @upRightButton
        > * ImageButtonGridRow
        >> ({arrow.left}) @centerLeftButton
        >> ({circle}) @centerButton
        >> ({arrow.right}) @centerRightButton
        > * ImageButtonGridRow
        >> ({arrow.down.left}) @downLeftButton
        >> ({arrow.down}) @downCenterButton
        >> ({arrow.down.right}) @downRightButton
        """
        descriptionData = dict()
        self.w = ezui.EZWindow(
            title="Demo",
            content=content,
            descriptionData=descriptionData,
            controller=self
        )

    def started(self):
        self.w.open()

    def upLeftButtonCallback(self, sender):
        print("upLeftButton was pushed.")

    def upCenterButtonCallback(self, sender):
        print("upCenterButton was pushed.")

    def upRightButtonCallback(self, sender):
        print("upRightButton was pushed.")

    def centerLeftButtonCallback(self, sender):
        print("centerLeftButton was pushed.")

    def centerButtonCallback(self, sender):
        print("centerButton was pushed.")

    def centerRightButtonCallback(self, sender):
        print("centerRightButton was pushed.")

    def downLeftButtonCallback(self, sender):
        print("downLeftButton was pushed.")

    def downCenterButtonCallback(self, sender):
        print("downCenterButton was pushed.")

    def downRightButtonCallback(self, sender):
        print("downRightButton was pushed.")

DemoController()
getItem(identifier)

Get the item with identifier contained within this container.