Version

Quick search

Action Bar

New in version 1.8.0.

_images/actionbar.png

The ActionBar widget is like Android’s ActionBar, where items are stacked horizontally. When the area becomes to small, widgets are moved into the ActionOverflow area.

An ActionBar must contain an ActionView with various ContextualActionViews. An ActionView must contain a child ActionPrevious which may have title, app_icon and previous_icon properties. ActionView children must be subclasses of ActionItems. Some predefined ones include an ActionButton, an ActionToggleButton, an ActionCheck, an ActionSeparator and an ActionGroup.

An ActionGroup is used to display ActionItems in a group. An ActionView will always display an ActionGroup after other ActionItems. An ActionView contains an ActionOverflow, but this is only made visible when required i.e. the available area is too small to fit all the widgets. A ContextualActionView is a subclass of an:class:ActionView.

Changed in version 1.10.1: ActionGroup core rewritten from Spinner to pure DropDown

class kivy.uix.actionbar.ActionBar(**kwargs)

Bases: kivy.uix.boxlayout.BoxLayout

ActionBar class, which acts as the main container for an ActionView instance. The ActionBar determines the overall styling aspects of the bar. ActionItems are not added to this class directly, but to the contained ActionView instance.

Events:
on_previous

Fired when action_previous of action_view is pressed.

Please see the module documentation for more information.

add_widget(widget, *args, **kwargs)

Changed in version 2.1.0: Renamed argument view to widget.

exception kivy.uix.actionbar.ActionBarException

Bases: Exception

ActionBarException class

class kivy.uix.actionbar.ActionButton(**kwargs)

Bases: kivy.uix.button.Button, kivy.uix.actionbar.ActionItem

ActionButton class, see module documentation for more information.

The text color, width and size_hint_x are set manually via the Kv language file. It covers a lot of cases: with/without an icon, with/without a group and takes care of the padding between elements.

You don’t have much control over these properties, so if you want to customize its appearance, we suggest you create you own button representation. You can do this by creating a class that subclasses an existing widget and an ActionItem:

class MyOwnActionButton(Button, ActionItem):
    pass

You can then create your own style using the Kv language.

class kivy.uix.actionbar.ActionCheck(**kwargs)

Bases: kivy.uix.actionbar.ActionItem, kivy.uix.checkbox.CheckBox

ActionCheck class, see module documentation for more information.

class kivy.uix.actionbar.ActionDropDown(**kwargs)

Bases: kivy.uix.dropdown.DropDown

ActionDropDown class, see module documentation for more information.

class kivy.uix.actionbar.ActionGroup(**kwargs)

Bases: kivy.uix.actionbar.ActionItem, kivy.uix.button.Button

ActionGroup class, see module documentation for more information.

add_widget(widget, *args, **kwargs)

Changed in version 2.1.0: Renamed argument item to widget.

clear_widgets(*args, **kwargs)

Remove all (or the specified) children of this widget. If the ‘children’ argument is specified, it should be a list (or filtered list) of children of the current widget.

Changed in version 1.8.0: The children argument can be used to specify the children you want to remove.

Changed in version 2.1.0: Specifying an empty children list leaves the widgets unchanged. Previously it was treated like None and all children were removed.

class kivy.uix.actionbar.ActionItem

Bases: builtins.object

ActionItem class, an abstract class for all ActionBar widgets. To create a custom widget for an ActionBar, inherit from this class. See module documentation for more information.

class kivy.uix.actionbar.ActionOverflow(**kwargs)

Bases: kivy.uix.actionbar.ActionGroup

ActionOverflow class, see module documentation for more information.

add_widget(widget, index=0, *args, **kwargs)

Changed in version 2.1.0: Renamed argument action_item to widget.

class kivy.uix.actionbar.ActionPrevious(**kwargs)

Bases: kivy.uix.boxlayout.BoxLayout, kivy.uix.actionbar.ActionItem

ActionPrevious class, see module documentation for more information.

class kivy.uix.actionbar.ActionSeparator(**kwargs)

Bases: kivy.uix.actionbar.ActionItem, kivy.uix.widget.Widget

ActionSeparator class, see module documentation for more information.

class kivy.uix.actionbar.ActionToggleButton(**kwargs)

Bases: kivy.uix.actionbar.ActionItem, kivy.uix.togglebutton.ToggleButton

ActionToggleButton class, see module documentation for more information.

class kivy.uix.actionbar.ActionView(**kwargs)

Bases: kivy.uix.boxlayout.BoxLayout

ActionView class, see module documentation for more information.

add_widget(widget, index=0, *args, **kwargs)

Changed in version 2.1.0: Renamed argument action_item to widget.

remove_widget(widget, *args, **kwargs)

Remove a widget from the children of this widget.

Parameters:
widget: Widget

Widget to remove from our children list.

>>> from kivy.uix.button import Button
>>> root = Widget()
>>> button = Button()
>>> root.add_widget(button)
>>> root.remove_widget(button)
class kivy.uix.actionbar.ContextualActionView(**kwargs)

Bases: kivy.uix.actionbar.ActionView

ContextualActionView class, see the module documentation for more information.