API References

Ribbon Bar

RibbonBar

class pyqtribbon.ribbonbar.RibbonBar(title: str = '', maxRows=6, parent=None)[source]
class pyqtribbon.ribbonbar.RibbonBar(parent=None)

Bases: QMenuBar

The RibbonBar class is the top level widget that contains the ribbon.

Methods

actionAt(self, a0)

actionGeometry(self, a0)

activeAction(self)

addAction(-> QAction)

addCategoriesBy(data)

Add categories from a dict.

addCategory(title[, style, color])

Add a new category to the ribbon.

addContextCategories(name, titles[, color])

Add a group of context categories with the same tab color to the ribbon.

addContextCategory(title[, color])

Add a new context category to the ribbon.

addFileMenu()

Add a file menu to the ribbon.

addMenu(-> QAction  -> QMenu)

addNormalCategory(title)

Add a new category to the ribbon.

addQuickAccessButton(button)

Add a button to the quick access bar.

addRightToolButton(button)

Add a widget to the right button bar.

addSeparator(self)

addTitleWidget(widget)

Add a widget to the title widget.

applicationOptionButton()

Return the application button.

categories()

Return a list of categories of the ribbon.

category(name)

Return the category with the given name.

categoryVisible(category)

Return whether the category is shown.

clear(self)

collapseRibbonButton()

Return the collapse ribbon button.

cornerWidget(self[, corner])

currentCategory()

Return the current category.

helpRibbonButton()

Return the help button of the ribbon.

hideContextCategory(category)

Hide the given category or categories, if it is not a context category, nothing happens.

hideRibbon()

Hide the ribbon.

insertMenu(self, before, menu)

insertSeparator(self, before)

insertTitleWidget(index, widget)

Insert a widget to the title widget.

isDefaultUp(self)

isNativeMenuBar(self)

minimumSizeHint()

Return the minimum size hint of the widget.

quickAccessToolBar()

Return the quick access toolbar of the ribbon.

removeCategories(categories)

Remove a list of categories from the ribbon.

removeCategory(category)

Remove a category from the ribbon.

removeCollapseButton()

Remove the min button from the ribbon.

removeHelpButton()

Remove the help button from the ribbon.

removeTitleWidget(widget)

Remove a widget from the title widget.

ribbonHeight()

Get the total height of the ribbon.

ribbonVisible()

Get the visibility of the ribbon.

rightToolBar()

Return the right toolbar of the ribbon.

setActiveAction(self, action)

setApplicationIcon(icon)

Set the application icon.

setCollapseButtonIcon(icon)

Set the icon of the min button.

setCornerWidget(self, widget[, corner])

setCurrentCategory(category)

Set the current category.

setDefaultUp(self, a0)

setHelpButtonIcon(icon)

Set the icon of the help button.

setNativeMenuBar(self, nativeMenuBar)

setQuickAccessButtonHeight([height])

Set the height of the quick access buttons.

setRibbonHeight(height)

Set the total height of the ribbon.

setRibbonStyle(style)

Set the style of the ribbon.

setRibbonVisible(visible)

Set the visibility of the ribbon.

setRightToolBarHeight([height])

Set the height of the right buttons.

setTitle(title)

Set the title of the ribbon.

showCategoryByIndex(index)

Show category by tab index

showContextCategory(category)

Show the given category or categories, if it is not a context category, nothing happens.

showRibbon()

Show the ribbon.

tabBar()

Return the tab bar of the ribbon.

title()

Return the title of the ribbon.

fileButtonClicked

helpButtonClicked

actionAt(self, a0: QPoint) QAction[source]
actionGeometry(self, a0: QAction) QRect[source]
activeAction(self) QAction[source]
addAction(self, action: QAction)[source]
addAction(self, text: str) QAction
addAction(self, text: str, slot: PYQT_SLOT) QAction
addCategoriesBy(data: Dict[str, Dict]) Dict[str, RibbonCategory][source]

Add categories from a dict.

Parameters

data

The dict of categories. The dict is of the form:

{
    "category-title": {
        "style": RibbonCategoryStyle.Normal,
        "color": QtCore.Qt.red,
        "panels":
            "panel-title": {
                "showPanelOptionButton": True,
                "widgets": {
                    "widget-name": {
                        "type": "Button",
                        "arguments": {
                            "key1": "value1",
                            "key2": "value2"
                        }
                    },
                }
            },
        },
    }
}

Returns

A dict of categories of the ribbon.

addCategory(title: str, style=RibbonCategoryStyle.Normal, color: Optional[QColor] = None) Union[RibbonNormalCategory, RibbonContextCategory][source]

Add a new category to the ribbon.

Parameters
  • title – The title of the category.

  • style – The button style of the category.

  • color – The color of the context category, only used if style is Context, if None, the default color will be used.

Returns

The newly created category.

addContextCategories(name: str, titles: List[str], color: Union[QColor, GlobalColor] = 9) RibbonContextCategories[source]

Add a group of context categories with the same tab color to the ribbon.

Parameters
  • name – The name of the context categories.

  • titles – The title of the category.

  • color – The color of the context category, if None, the default color will be used.

Returns

The newly created category.

addContextCategory(title: str, color: Union[QColor, GlobalColor] = 9) RibbonContextCategory[source]

Add a new context category to the ribbon.

Parameters
  • title – The title of the category.

  • color – The color of the context category, if None, the default color will be used.

Returns

The newly created category.

addFileMenu() RibbonMenu[source]

Add a file menu to the ribbon.

addMenu(self, menu: QMenu) QAction[source]
addMenu(self, title: str) QMenu
addMenu(self, icon: QIcon, title: str) QMenu
addNormalCategory(title: str) RibbonNormalCategory[source]

Add a new category to the ribbon.

Parameters

title – The title of the category.

Returns

The newly created category.

addQuickAccessButton(button: QToolButton)[source]

Add a button to the quick access bar.

Parameters

button – The button to add.

addRightToolButton(button: QToolButton)[source]

Add a widget to the right button bar.

Parameters

button – The button to add.

addSeparator(self) QAction[source]
addTitleWidget(widget: QWidget)[source]

Add a widget to the title widget.

Parameters

widget – The widget to add.

applicationOptionButton() RibbonApplicationButton[source]

Return the application button.

categories() Dict[str, RibbonCategory][source]

Return a list of categories of the ribbon.

Returns

A dict of categories of the ribbon.

category(name: str) RibbonCategory[source]

Return the category with the given name.

Parameters

name – The name of the category.

Returns

The category with the given name.

categoryVisible(category: RibbonCategory) bool[source]

Return whether the category is shown.

Parameters

category – The category to check.

Returns

Whether the category is shown.

clear(self)[source]
collapseRibbonButton() QToolButton[source]

Return the collapse ribbon button.

Returns

The collapse ribbon button.

cornerWidget(self, corner: Corner = Qt.TopRightCorner) QWidget[source]
currentCategory() RibbonCategory[source]

Return the current category.

Returns

The current category.

fileButtonClicked[source]

Signal, the file button was clicked.

helpButtonClicked(bool)[source]

Signal, the help button was clicked.

helpRibbonButton() QToolButton[source]

Return the help button of the ribbon.

Returns

The help button of the ribbon.

hideContextCategory(category: Union[RibbonContextCategory, RibbonContextCategories])[source]

Hide the given category or categories, if it is not a context category, nothing happens.

Parameters

category – The category to hide.

hideRibbon()[source]

Hide the ribbon.

insertMenu(self, before: QAction, menu: QMenu) QAction[source]
insertSeparator(self, before: QAction) QAction[source]
insertTitleWidget(index: int, widget: QWidget)[source]

Insert a widget to the title widget.

Parameters
  • index – The index to insert the widget.

  • widget – The widget to insert.

isDefaultUp(self) bool[source]
isNativeMenuBar(self) bool[source]
minimumSizeHint() QSize[source]

Return the minimum size hint of the widget.

Returns

The minimum size hint.

quickAccessToolBar() QToolBar[source]

Return the quick access toolbar of the ribbon.

Returns

The quick access toolbar of the ribbon.

removeCategories(categories: RibbonContextCategories)[source]

Remove a list of categories from the ribbon.

Parameters

categories – The categories to remove.

removeCategory(category: RibbonCategory)[source]

Remove a category from the ribbon.

Parameters

category – The category to remove.

removeCollapseButton()[source]

Remove the min button from the ribbon.

removeHelpButton()[source]

Remove the help button from the ribbon.

removeTitleWidget(widget: QWidget)[source]

Remove a widget from the title widget.

Parameters

widget – The widget to remove.

ribbonHeight() int[source]

Get the total height of the ribbon.

Returns

The height of the ribbon.

ribbonVisible() bool[source]

Get the visibility of the ribbon.

Returns

True if the ribbon is visible, False otherwise.

rightToolBar() QToolBar[source]

Return the right toolbar of the ribbon.

Returns

The right toolbar of the ribbon.

setActiveAction(self, action: QAction)[source]
setApplicationIcon(icon: QIcon)[source]

Set the application icon.

Parameters

icon – The icon to set.

setCollapseButtonIcon(icon: QIcon)[source]

Set the icon of the min button.

Parameters

icon – The icon to set.

setCornerWidget(self, widget: QWidget, corner: Corner = Qt.TopRightCorner)[source]
setCurrentCategory(category: RibbonCategory)[source]

Set the current category.

Parameters

category – The category to set.

setDefaultUp(self, a0: bool)[source]
setHelpButtonIcon(icon: QIcon)[source]

Set the icon of the help button.

Parameters

icon – The icon to set.

setNativeMenuBar(self, nativeMenuBar: bool)[source]
setQuickAccessButtonHeight(height: int = 30)[source]

Set the height of the quick access buttons.

Parameters

height – The height to set.

setRibbonHeight(height: int)[source]

Set the total height of the ribbon.

Parameters

height – The height to set.

setRibbonStyle(style: RibbonStyle)[source]

Set the style of the ribbon.

Parameters

style – The style to set.

setRibbonVisible(visible: bool)[source]

Set the visibility of the ribbon.

Parameters

visible – True to show the ribbon, False to hide it.

setRightToolBarHeight(height: int = 24)[source]

Set the height of the right buttons.

Parameters

height – The height to set.

setTitle(title: str)[source]

Set the title of the ribbon.

Parameters

title – The title to set.

showCategoryByIndex(index: int)[source]

Show category by tab index

Parameters

index – tab index

showContextCategory(category: Union[RibbonContextCategory, RibbonContextCategories])[source]

Show the given category or categories, if it is not a context category, nothing happens.

Parameters

category – The category to show.

showRibbon()[source]

Show the ribbon.

tabBar() RibbonTabBar[source]

Return the tab bar of the ribbon.

Returns

The tab bar of the ribbon.

title() str[source]

Return the title of the ribbon.

Returns

The title of the ribbon.

Ribbon Title

RibbonApplicationButton

class pyqtribbon.titlewidget.RibbonApplicationButton[source]

Bases: QToolButton

Application button in the ribbon bar.

Methods

addFileMenu()

Add a new ribbon menu to the application button.

addFileMenu() RibbonMenu[source]

Add a new ribbon menu to the application button.

Returns

The new ribbon menu.

RibbonTabBar

class pyqtribbon.tabbar.RibbonTabBar(parent=None)[source]

Bases: QTabBar

The TabBar for the title widget.

Methods

addAssociatedTabs(name, texts, color)

Add associated multiple tabs which have the same color to the tab bar.

addTab(text[, color])

Add a new tab to the tab bar.

currentTabColor()

Current tab color

indexOf(tabName)

Return the index of the tab with the given name.

paintEvent(a0)

Paint the tab bar.

removeAssociatedTabs(titles)

Remove tabs with the given titles.

tabTitles()

Return the titles of all tabs.

addAssociatedTabs(name: str, texts: List[str], color: QColor) List[int][source]

Add associated multiple tabs which have the same color to the tab bar.

Parameters
  • name – The name of the context category.

  • texts – The texts of the tabs.

  • color – The color of the tabs.

Returns

The indices of the tabs.

addTab(text: str, color: Optional[QColor] = None) int[source]

Add a new tab to the tab bar.

Parameters
  • text – The text of the tab.

  • color – The color of the tab.

Returns

The index of the tab.

currentTabColor() QColor[source]

Current tab color

Returns

Current tab color

indexOf(tabName: str) int[source]

Return the index of the tab with the given name.

Parameters

tabName – The name of the tab.

Returns

The index of the tab.

paintEvent(a0: QPaintEvent) None[source]

Paint the tab bar.

removeAssociatedTabs(titles: List[str]) None[source]

Remove tabs with the given titles.

Parameters

titles – The titles of the tabs to remove.

tabTitles() List[str][source]

Return the titles of all tabs.

Returns

The titles of all tabs.

RibbonTitleLabel

class pyqtribbon.titlewidget.RibbonTitleLabel[source]

Bases: QLabel

Title label in the ribbon bar.

RibbonTitleWidget

class pyqtribbon.titlewidget.RibbonTitleWidget(title='PyQtRibbon', parent=None)[source]
class pyqtribbon.titlewidget.RibbonTitleWidget(parent=None)

Bases: QFrame

The title widget of the ribbon.

Methods

addQuickAccessButton(button)

Add a widget to the quick access bar.

addRightToolButton(button)

Add a widget to the right button bar.

addTitleWidget(widget)

Add a widget to the title layout.

applicationButton()

Return the application button.

collapseRibbonButton()

Return the collapse ribbon button.

helpRibbonButton()

Return the help ribbon button.

insertTitleWidget(index, widget)

Insert a widget to the title layout.

quickAccessButtons()

Return the quick access buttons of the ribbon.

quickAccessToolBar()

Return the quick access toolbar of the ribbon.

removeCollapseButton()

Remove the min button from the ribbon.

removeHelpButton()

Remove the help button from the ribbon.

removeTitleWidget(widget)

Remove a widget from the title layout.

rightToolBar()

Return the right toolbar of the ribbon.

setApplicationIcon(icon)

Set the application icon.

setCollapseButtonIcon(icon)

Set the icon of the min button.

setHelpButtonIcon(icon)

Set the icon of the help button.

setQuickAccessButtonHeight([height])

Set the height of the quick access buttons.

setRightToolBarHeight([height])

Set the height of the right buttons.

setTitle(title)

Set the title of the ribbon.

tabBar()

Return the tab bar of the ribbon.

title()

Return the title of the ribbon.

collapseRibbonButtonClicked

helpButtonClicked

addQuickAccessButton(button: QToolButton)[source]

Add a widget to the quick access bar.

Parameters

button – The button to add.

addRightToolButton(button: QToolButton)[source]

Add a widget to the right button bar.

Parameters

button – The button to add.

addTitleWidget(widget: QWidget)[source]

Add a widget to the title layout.

Parameters

widget – The widget to add.

applicationButton() RibbonApplicationButton[source]

Return the application button.

collapseRibbonButton() QToolButton[source]

Return the collapse ribbon button.

Returns

The collapse ribbon button.

collapseRibbonButtonClicked(bool)[source]

Signal, the collapse button wa clicked.

helpButtonClicked(bool)[source]

Signal, the help button was clicked.

helpRibbonButton() QToolButton[source]

Return the help ribbon button.

Returns

The help ribbon button.

insertTitleWidget(index: int, widget: QWidget)[source]

Insert a widget to the title layout.

Parameters
  • index – The index to insert the widget.

  • widget – The widget to insert.

quickAccessButtons() List[QToolButton][source]

Return the quick access buttons of the ribbon.

Returns

The quick access buttons of the ribbon.

quickAccessToolBar() QToolBar[source]

Return the quick access toolbar of the ribbon.

Returns

The quick access toolbar of the ribbon.

removeCollapseButton()[source]

Remove the min button from the ribbon.

removeHelpButton()[source]

Remove the help button from the ribbon.

removeTitleWidget(widget: QWidget)[source]

Remove a widget from the title layout.

Parameters

widget – The widget to remove.

rightToolBar() QToolBar[source]

Return the right toolbar of the ribbon.

Returns

The right toolbar of the ribbon.

setApplicationIcon(icon: QIcon)[source]

Set the application icon.

Parameters

icon – The icon to set.

setCollapseButtonIcon(icon: QIcon)[source]

Set the icon of the min button.

Parameters

icon – The icon to set.

setHelpButtonIcon(icon: QIcon)[source]

Set the icon of the help button.

Parameters

icon – The icon to set.

setQuickAccessButtonHeight(height: int = 30)[source]

Set the height of the quick access buttons.

Parameters

height – The height to set.

setRightToolBarHeight(height: int = 24)[source]

Set the height of the right buttons.

Parameters

height – The height to set.

setTitle(title: str)[source]

Set the title of the ribbon.

Parameters

title – The title to set.

tabBar() RibbonTabBar[source]

Return the tab bar of the ribbon.

Returns

The tab bar of the ribbon.

title() str[source]

Return the title of the ribbon.

Returns

The title of the ribbon.

Ribbon Stacked Widget

RibbonStackedWidget

class pyqtribbon.ribbonbar.RibbonStackedWidget(parent=None)[source]

Bases: QStackedWidget

Stacked widget that is used to display the ribbon.

Ribbon Category

RibbonCategory

class pyqtribbon.category.RibbonCategory(title: str = '', style: RibbonCategoryStyle = RibbonCategoryStyle.Normal, color: QColor = None, parent=None)[source]
class pyqtribbon.category.RibbonCategory(parent=None)

Bases: QFrame

The RibbonCategory is the logical grouping that represents the contents of a ribbon tab.

Methods

addPanel(title[, showPanelOptionButton])

Add a new panel to the category.

addPanelsBy(data)

Add panels from a dictionary.

categoryStyle()

Return the button style of the category.

panel(title)

Return a panel from the category.

panels()

Return all panels in the category.

removePanel(title)

Remove a panel from the category.

setCategoryStyle(style)

Set the button style of the category.

setMaximumRows(rows)

Set the maximum number of rows.

takePanel(title)

Remove and return a panel from the category.

title()

Return the title of the category.

addPanel(title: str, showPanelOptionButton=True) RibbonPanel[source]

Add a new panel to the category.

Parameters
  • title – The title of the panel.

  • showPanelOptionButton – Whether to show the panel option button.

Returns

The newly created panel.

addPanelsBy(data: Dict[str, Dict]) Dict[str, RibbonPanel][source]

Add panels from a dictionary.

Parameters

data

The dictionary. The keys are the titles of the panels. The value is a dictionary of arguments. the argument showPanelOptionButton is a boolean to decide whether to show the panel option button, the rest arguments are passed to the RibbonPanel.addWidgetsBy() method. The dict is of the form: {

”panel-title”: {

“showPanelOptionButton”: True, “widgets”: {

”widget-name”: {

“type”: “Button”, “arguments”: {

”key1”: “value1”, “key2”: “value2”

}

},

}

},

}

Returns

A dictionary of the newly created panels.

categoryStyle() RibbonCategoryStyle[source]

Return the button style of the category.

Returns

The button style.

panel(title: str) RibbonPanel[source]

Return a panel from the category.

Parameters

title – The title of the panel.

Returns

The panel.

panels() Dict[str, RibbonPanel][source]

Return all panels in the category.

Returns

The panels.

removePanel(title: str)[source]

Remove a panel from the category.

Parameters

title – The title of the panel.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters

style – The button style.

setMaximumRows(rows: int)[source]

Set the maximum number of rows.

Parameters

rows – The maximum number of rows.

takePanel(title: str) RibbonPanel[source]

Remove and return a panel from the category.

Parameters

title – The title of the panel.

Returns

The removed panel.

title() str[source]

Return the title of the category.

RibbonNormalCategory

class pyqtribbon.category.RibbonNormalCategory(title: str, parent: QWidget)[source]

Bases: RibbonCategory

A normal category.

Methods

setCategoryStyle(style)

Set the button style of the category.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters

style – The button style.

RibbonContextCategory

class pyqtribbon.category.RibbonContextCategory(title: str, color: QColor, parent: QWidget)[source]

Bases: RibbonCategory

A context category.

Methods

categoryVisible()

Return whether the category is shown.

color()

Return the color of the context category.

hideContextCategory()

Hide the given category, if it is not a context category, nothing happens.

setCategoryStyle(style)

Set the button style of the category.

setCategoryVisible(visible)

Set the state of the category.

setColor(color)

Set the color of the context category.

showContextCategory()

Show the given category, if it is not a context category, nothing happens.

categoryVisible() bool[source]

Return whether the category is shown.

Returns

Whether the category is shown.

color() QColor[source]

Return the color of the context category.

Returns

The color of the context category.

hideContextCategory()[source]

Hide the given category, if it is not a context category, nothing happens.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters

style – The button style.

setCategoryVisible(visible: bool)[source]

Set the state of the category.

Parameters

visible – The state.

setColor(color: QColor)[source]

Set the color of the context category.

Parameters

color – The color of the context category.

showContextCategory()[source]

Show the given category, if it is not a context category, nothing happens.

RibbonContextCategories

class pyqtribbon.category.RibbonContextCategories(name: str, color: QColor, categories: Dict[str, RibbonContextCategory], ribbon)[source]

Bases: Dict[str, RibbonContextCategory]

A list of context categories.

Methods

categoriesVisible()

Return whether the categories are shown.

color()

Return the color of the context categories.

hideContextCategories()

Hide the categories

name()

Return the name of the context categories.

setCategoriesVisible(visible)

Set the state of the categories.

setColor(color)

Set the color of the context categories.

setName(name)

Set the name of the context categories.

showContextCategories()

Show the categories

categoriesVisible() bool[source]

Return whether the categories are shown.

color() QColor[source]

Return the color of the context categories.

hideContextCategories()[source]

Hide the categories

name() str[source]

Return the name of the context categories.

setCategoriesVisible(visible: bool)[source]

Set the state of the categories.

setColor(color: QColor)[source]

Set the color of the context categories.

setName(name: str)[source]

Set the name of the context categories.

showContextCategories()[source]

Show the categories

RibbonCategoryStyle

class pyqtribbon.category.RibbonCategoryStyle(value)[source]

Bases: IntEnum

The button style of a category.

RibbonCategoryScrollArea

RibbonCategoryScrollAreaContents

RibbonCategoryLayoutButton

RibbonCategoryLayoutWidget

Ribbon Panel

RibbonPanel

class pyqtribbon.panel.RibbonPanel(title: str = '', maxRows: int = 6, showPanelOptionButton=True, parent=None)[source]
class pyqtribbon.panel.RibbonPanel(parent=None)

Bases: QFrame

Panel in the ribbon category.

Methods

addButton([text, icon, style, showText, ...])

Add a button to the panel.

addCalendarWidget([rowSpan, colSpan, mode, ...])

Add a calendar widget to the panel.

addComboBox(items[, rowSpan, colSpan, mode, ...])

Add a combo box to the panel.

addDateEdit([rowSpan, colSpan, mode, ...])

Add a date edit to the panel.

addDateTimeEdit([rowSpan, colSpan, mode, ...])

Add a date time edit to the panel.

addDoubleSpinBox([rowSpan, colSpan, mode, ...])

Add a double spin box to the panel.

addFontComboBox([rowSpan, colSpan, mode, ...])

Add a font combo box to the panel.

addGallery([minimumWidth, popupHideOnClick, ...])

Add a gallery to the panel.

addHorizontalSeparator([width, rowSpan, ...])

Add a horizontal separator to the panel.

addLabel(text[, rowSpan, colSpan, mode, ...])

Add a label to the panel.

addLargeButton([text, icon, showText, ...])

Add a large button to the panel.

addLargeToggleButton([text, icon, showText, ...])

Add a large toggle button to the panel.

addLargeWidget(widget[, mode, alignment, ...])

Add a large widget to the panel.

addLineEdit([rowSpan, colSpan, mode, ...])

Add a line edit to the panel.

addListWidget([rowSpan, colSpan, mode, ...])

Add a list widget to the panel.

addMediumButton([text, icon, showText, ...])

Add a medium button to the panel.

addMediumToggleButton([text, icon, ...])

Add a medium toggle button to the panel.

addMediumWidget(widget[, mode, alignment, ...])

Add a medium widget to the panel.

addPlainTextEdit([rowSpan, colSpan, mode, ...])

Add a plain text edit to the panel.

addProgressBar([rowSpan, colSpan, mode, ...])

Add a progress bar to the panel.

addSeparator([orientation, width, rowSpan, ...])

Add a separator to the panel.

addSlider([rowSpan, colSpan, mode, ...])

Add a slider to the panel.

addSmallButton([text, icon, showText, ...])

Add a small button to the panel.

addSmallToggleButton([text, icon, showText, ...])

Add a small toggle button to the panel.

addSmallWidget(widget[, mode, alignment, ...])

Add a small widget to the panel.

addSpinBox([rowSpan, colSpan, mode, ...])

Add a spin box to the panel.

addTableWidget([rowSpan, colSpan, mode, ...])

Add a table widget to the panel.

addTextEdit([rowSpan, colSpan, mode, ...])

Add a text edit to the panel.

addTimeEdit([rowSpan, colSpan, mode, ...])

Add a time edit to the panel.

addToggleButton([text, icon, style, ...])

Add a toggle button to the panel.

addTreeWidget([rowSpan, colSpan, mode, ...])

Add a tree widget to the panel.

addVerticalSeparator([width, rowSpan, ...])

Add a vertical separator to the panel.

addWidget(widget[, rowSpan, colSpan, mode, ...])

Add a widget to the panel.

addWidgetsBy(data)

Add widgets to the panel.

defaultRowSpan(rowSpan)

Return the number of span rows for the given widget type.

largeRows()

Return the number of span rows for large widgets.

maximumRows()

Return the maximal number of rows in the panel.

mediumRows()

Return the number of span rows for medium widgets.

panelOptionButton()

Return the panel option button.

removeWidget(widget)

Remove a widget from the panel.

rowHeight()

Return the height of a row.

setLargeRows(rows)

Set the number of span rows for large widgets.

setMaximumRows(maxRows)

Set the maximal number of rows in the panel.

setMediumRows(rows)

Set the number of span rows for medium widgets.

setPanelOptionToolTip(text)

Set the tooltip of the panel option button.

setSmallRows(rows)

Set the number of span rows for small widgets.

setTitle(title)

Set the title of the panel.

smallRows()

Return the number of span rows for small widgets.

title()

Get the title of the panel.

widget(index)

Get the widget at the given index.

widgets()

Get all the widgets in the panel.

panelOptionClicked

addButton(text: Optional[str] = None, icon: Optional[QIcon] = None, style: RibbonButtonStyle = RibbonButtonStyle.Large, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • style – The style of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addCalendarWidget(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QCalendarWidget[source]

Add a calendar widget to the panel.

Parameters
  • rowSpan – The number of rows the calendar widget should span.

  • colSpan – The number of columns the calendar widget should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the calendar widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The calendar widget that was added.

addComboBox(items: List[str], rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QComboBox[source]

Add a combo box to the panel.

Parameters
  • items – The items of the combo box.

  • rowSpan – The number of rows the combo box should span.

  • colSpan – The number of columns the combo box should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the combo box.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The combo box that was added.

addDateEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QDateEdit[source]

Add a date edit to the panel.

Parameters
  • rowSpan – The number of rows the date edit should span.

  • colSpan – The number of columns the date edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the date edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The date edit that was added.

addDateTimeEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QDateTimeEdit[source]

Add a date time edit to the panel.

Parameters
  • rowSpan – The number of rows the date time edit should span.

  • colSpan – The number of columns the date time edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the date time edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The date time edit that was added.

addDoubleSpinBox(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QDoubleSpinBox[source]

Add a double spin box to the panel.

Parameters
  • rowSpan – The number of rows the double spin box should span.

  • colSpan – The number of columns the double spin box should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the double spin box.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The double spin box that was added.

addFontComboBox(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QFontComboBox[source]

Add a font combo box to the panel.

Parameters
  • rowSpan – The number of rows the combo box should span.

  • colSpan – The number of columns the combo box should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the combo box.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The combo box that was added.

addGallery(minimumWidth=800, popupHideOnClick=False, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonGallery[source]

Add a gallery to the panel.

Parameters
  • minimumWidth – The minimum width of the gallery.

  • popupHideOnClick – Whether the gallery popup should be hidden when a user clicks on it.

  • rowSpan – The number of rows the gallery spans.

  • colSpan – The number of columns the gallery spans.

  • mode – The mode of the gallery.

  • alignment – The alignment of the gallery.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The gallery.

addHorizontalSeparator(width=6, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 2, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonHorizontalSeparator[source]

Add a horizontal separator to the panel.

Parameters
  • width – The width of the separator.

  • rowSpan – The number of rows the separator spans.

  • colSpan – The number of columns the separator spans.

  • mode – The mode to find spaces.

  • alignment – The alignment of the separator.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The separator.

addLabel(text: str, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QLabel[source]

Add a label to the panel.

Parameters
  • text – The text of the label.

  • rowSpan – The number of rows the label should span.

  • colSpan – The number of columns the label should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the label.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The label that was added.

addLargeButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a large button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addLargeToggleButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a large toggle button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addLargeWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False)[source]

Add a large widget to the panel.

Parameters
  • widget – The widget to add.

  • mode – The mode to find spaces.

  • alignment – The alignment of the widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

addLineEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QLineEdit[source]

Add a line edit to the panel.

Parameters
  • rowSpan – The number of rows the line edit should span.

  • colSpan – The number of columns the line edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the line edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The line edit that was added.

addListWidget(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QListWidget[source]

Add a list widget to the panel.

Parameters
  • rowSpan – The number of rows the list widget should span.

  • colSpan – The number of columns the list widget should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the list widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The list widget that was added.

addMediumButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a medium button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addMediumToggleButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a medium toggle button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addMediumWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False)[source]

Add a medium widget to the panel.

Parameters
  • widget – The widget to add.

  • mode – The mode to find spaces.

  • alignment – The alignment of the widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

addPlainTextEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QPlainTextEdit[source]

Add a plain text edit to the panel.

Parameters
  • rowSpan – The number of rows the text edit should span.

  • colSpan – The number of columns the text edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the text edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The text edit that was added.

addProgressBar(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QProgressBar[source]

Add a progress bar to the panel.

Parameters
  • rowSpan – The number of rows the progress bar should span.

  • colSpan – The number of columns the progress bar should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the progress bar.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The progress bar that was added.

addSeparator(orientation=2, width=6, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) Union[RibbonHorizontalSeparator, RibbonVerticalSeparator][source]

Add a separator to the panel.

Parameters
  • orientation – The orientation of the separator.

  • width – The width of the separator.

  • rowSpan – The number of rows the separator spans.

  • colSpan – The number of columns the separator spans.

  • mode – The mode to find spaces.

  • alignment – The alignment of the separator.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The separator.

addSlider(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QSlider[source]

Add a slider to the panel.

Parameters
  • rowSpan – The number of rows the slider should span.

  • colSpan – The number of columns the slider should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the slider.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The slider that was added.

addSmallButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a small button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addSmallToggleButton(text: Optional[str] = None, icon: Optional[QIcon] = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a small toggle button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addSmallWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False)[source]

Add a small widget to the panel.

Parameters
  • widget – The widget to add.

  • mode – The mode to find spaces.

  • alignment – The alignment of the widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The widget that was added.

addSpinBox(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QSpinBox[source]

Add a spin box to the panel.

Parameters
  • rowSpan – The number of rows the spin box should span.

  • colSpan – The number of columns the spin box should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the spin box.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The spin box that was added.

addTableWidget(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QTableWidget[source]

Add a table widget to the panel.

Parameters
  • rowSpan – The number of rows the table widget should span.

  • colSpan – The number of columns the table widget should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the table widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The table widget that was added.

addTextEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QTextEdit[source]

Add a text edit to the panel.

Parameters
  • rowSpan – The number of rows the text edit should span.

  • colSpan – The number of columns the text edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the text edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The text edit that was added.

addTimeEdit(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QTimeEdit[source]

Add a time edit to the panel.

Parameters
  • rowSpan – The number of rows the time edit should span.

  • colSpan – The number of columns the time edit should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the time edit.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The time edit that was added.

addToggleButton(text: Optional[str] = None, icon: Optional[QIcon] = None, style: RibbonButtonStyle = RibbonButtonStyle.Large, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonToolButton[source]

Add a toggle button to the panel.

Parameters
  • text – The text of the button.

  • icon – The icon of the button.

  • style – The style of the button.

  • showText – Whether to show the text of the button.

  • colSpan – The number of columns the button should span.

  • slot – The slot to call when the button is clicked.

  • shortcut – The shortcut of the button.

  • tooltip – The tooltip of the button.

  • statusTip – The status tip of the button.

  • mode – The mode to find spaces.

  • alignment – The alignment of the button.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The button that was added.

addTreeWidget(rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) QTreeWidget[source]

Add a tree widget to the panel.

Parameters
  • rowSpan – The number of rows the tree widget should span.

  • colSpan – The number of columns the tree widget should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the tree widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The tree widget that was added.

addVerticalSeparator(width=6, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False) RibbonVerticalSeparator[source]

Add a vertical separator to the panel.

Parameters
  • width – The width of the separator.

  • rowSpan – The number of rows the separator spans.

  • colSpan – The number of columns the separator spans.

  • mode – The mode to find spaces.

  • alignment – The alignment of the separator.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

Returns

The separator.

addWidget(widget: QWidget, rowSpan: Union[int, RibbonButtonStyle] = RibbonButtonStyle.Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132, fixedHeight: Union[bool, float] = False)[source]

Add a widget to the panel.

Parameters
  • widget – The widget to add.

  • rowSpan – The number of rows the widget should span, 2: small, 3: medium, 6: large.

  • colSpan – The number of columns the widget should span.

  • mode – The mode to find spaces.

  • alignment – The alignment of the widget.

  • fixedHeight – Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed.

addWidgetsBy(data: Dict[str, Dict]) Dict[str, QWidget][source]

Add widgets to the panel.

Parameters

data

The data to add. The dict is of the form: {

”widget-name”: {

“type”: “Button”, “arguments”: {

”key1”: “value1”, “key2”: “value2”

}

},

} Possible types are: Button, SmallButton, MediumButton, LargeButton, ToggleButton, SmallToggleButton, MediumToggleButton, LargeToggleButton, ComboBox, FontComboBox, LineEdit, TextEdit, PlainTextEdit, Label, ProgressBar, SpinBox, DoubleSpinBox, DataEdit, TimeEdit, DateTimeEdit, TableWidget, TreeWidget, ListWidget, CalendarWidget, Separator, HorizontalSeparator, VerticalSeparator, Gallery.

Returns

A dictionary of the added widgets.

defaultRowSpan(rowSpan: Union[int, RibbonButtonStyle])[source]

Return the number of span rows for the given widget type.

Parameters

rowSpan – row span or type.

Returns

The number of span rows for the given widget type.

largeRows() int[source]

Return the number of span rows for large widgets.

Returns

The number of span rows for large widgets.

maximumRows() int[source]

Return the maximal number of rows in the panel.

Returns

The maximal number of rows in the panel.

mediumRows() int[source]

Return the number of span rows for medium widgets.

Returns

The number of span rows for medium widgets.

panelOptionButton() RibbonPanelOptionButton[source]

Return the panel option button.

Returns

The panel option button.

removeWidget(widget: QWidget)[source]

Remove a widget from the panel.

rowHeight() int[source]

Return the height of a row.

setLargeRows(rows: int)[source]

Set the number of span rows for large widgets.

Parameters

rows – The number of span rows for large widgets.

setMaximumRows(maxRows: int)[source]

Set the maximal number of rows in the panel.

Parameters

maxRows – The maximal number of rows in the panel.

setMediumRows(rows: int)[source]

Set the number of span rows for medium widgets.

Parameters

rows – The number of span rows for medium widgets.

setPanelOptionToolTip(text: str)[source]

Set the tooltip of the panel option button.

Parameters

text – The tooltip text.

setSmallRows(rows: int)[source]

Set the number of span rows for small widgets.

Parameters

rows – The number of span rows for small widgets.

setTitle(title: str)[source]

Set the title of the panel.

Parameters

title – The title to set.

smallRows() int[source]

Return the number of span rows for small widgets.

Returns

The number of span rows for small widgets.

title()[source]

Get the title of the panel.

Returns

The title.

widget(index: int) QWidget[source]

Get the widget at the given index.

Parameters

index – The index of the widget, starting from 0.

Returns

The widget at the given index.

widgets() List[QWidget][source]

Get all the widgets in the panel.

Returns

A list of all the widgets in the panel.

RibbonPanelItemWidget

class pyqtribbon.panel.RibbonPanelItemWidget(parent=None)[source]

Bases: QFrame

Widget to display a panel item.

Methods

addWidget(widget)

Add a widget to the panel item.

addWidget(widget)[source]

Add a widget to the panel item.

Parameters

widget – The widget to add.

RibbonSpaceFindMode

class pyqtribbon.panel.RibbonSpaceFindMode(value)[source]

Bases: IntEnum

Mode to find available space in a grid layout, ColumnWise or RowWise.

RibbonGridLayoutManager

class pyqtribbon.panel.RibbonGridLayoutManager(rows: int)[source]

Bases: object

Grid Layout Manager.

Methods

request_cells([rowSpan, colSpan, mode])

Request a number of available cells from the grid.

request_cells(rowSpan: int = 1, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise)[source]

Request a number of available cells from the grid.

Parameters
  • rowSpan – The number of rows the cell should span.

  • colSpan – The number of columns the cell should span.

  • mode – The mode of the grid.

Returns

row, col, the row and column of the requested cell.

Ribbon Tool Button

RibbonToolButton

class pyqtribbon.toolbutton.RibbonToolButton(parent=None)[source]

Bases: QToolButton

Tool button that is showed in the ribbon.

Methods

addRibbonMenu()

Add a ribbon menu for the button.

buttonStyle()

Get the button style of the button.

maximumIconSize()

Get the maximum icon size of the button.

setButtonStyle(style)

Set the button style of the button.

setMaximumIconSize(size)

Set the maximum icon size of the button.

addRibbonMenu() RibbonMenu[source]

Add a ribbon menu for the button.

Returns

The added ribbon menu.

buttonStyle() RibbonButtonStyle[source]

Get the button style of the button.

Returns

The button style of the button.

maximumIconSize() int[source]

Get the maximum icon size of the button.

Returns

The maximum icon size of the button.

setButtonStyle(style: RibbonButtonStyle)[source]

Set the button style of the button.

Parameters

style – The button style of the button.

setMaximumIconSize(size: int)[source]

Set the maximum icon size of the button.

Parameters

size – The maximum icon size of the button.

RibbonButtonStyle

class pyqtribbon.toolbutton.RibbonButtonStyle(value)[source]

Bases: IntEnum

Button style, Small, Medium, or Large.

Ribbon Separator

RibbonSeparator

class pyqtribbon.separator.RibbonSeparator(orientation=QtCore.Qt.Vertical, width=6, parent=None)[source]
class pyqtribbon.separator.RibbonSeparator(parent=None)

Bases: QFrame

The RibbonSeparator is a separator that can be used to separate widgets in a ribbon.

Methods

paintEvent(event)

Paint the separator.

setTopBottomMargins(top, bottom)

Set the top and bottom margins.

sizeHint()

Return the size hint.

paintEvent(event: QPaintEvent) None[source]

Paint the separator.

setTopBottomMargins(top: int, bottom: int) None[source]

Set the top and bottom margins.

sizeHint() QSize[source]

Return the size hint.

RibbonHorizontalSeparator

class pyqtribbon.separator.RibbonHorizontalSeparator(width: int = 6, parent=None)[source]

Bases: RibbonSeparator

Horizontal separator.

RibbonVerticalSeparator

class pyqtribbon.separator.RibbonVerticalSeparator(width: int = 6, parent=None)[source]

Bases: RibbonSeparator

Vertical separator.

Ribbon Menu

RibbonMenu

class pyqtribbon.menu.RibbonMenu(title: str = '', parent=None)[source]
class pyqtribbon.menu.RibbonMenu(parent=None)

Bases: QMenu

Methods

addFormLayoutWidget()

Add a form layout widget to the menu.

addGridLayoutWidget()

Add a grid layout widget to the menu.

addHorizontalLayoutWidget()

Add a horizontal layout widget to the menu.

addLabel([text, alignment])

Add a label to the menu.

addSpacing([spacing])

Add spacing to the menu.

addVerticalLayoutWidget()

Add a vertical layout widget to the menu.

addWidget(widget)

Add a widget to the menu.

addFormLayoutWidget() QFormLayout[source]

Add a form layout widget to the menu.

Returns

The form layout.

addGridLayoutWidget() QGridLayout[source]

Add a grid layout widget to the menu.

Returns

The grid layout.

addHorizontalLayoutWidget() QHBoxLayout[source]

Add a horizontal layout widget to the menu.

Returns

The horizontal layout.

addLabel(text: str = '', alignment: Alignment = 1)[source]

Add a label to the menu.

Parameters
  • text – The text of the label.

  • alignment – The alignment of the label.

addSpacing(spacing: int = 5)[source]

Add spacing to the menu.

Parameters

spacing – The spacing.

addVerticalLayoutWidget() QVBoxLayout[source]

Add a vertical layout widget to the menu.

Returns

The vertical layout.

addWidget(widget: QWidget)[source]

Add a widget to the menu.

Parameters

widget – The widget to add.

RibbonPermanentMenu

class pyqtribbon.menu.RibbonPermanentMenu(title: str = '', parent=None)[source]
class pyqtribbon.menu.RibbonPermanentMenu(parent=None)

Bases: RibbonMenu

A permanent menu.

Methods

actionEvent(self, a0)

hideEvent(self, a0)

actionAdded

actionEvent(self, a0: QActionEvent)[source]
hideEvent(self, a0: QHideEvent)[source]