API References

Ribbon Bar

RibbonBar

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

Bases: QMenuBar

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

Methods

actionAt(self, QPoint)

actionGeometry(self, QAction)

activeAction(self)

addAction(-> QAction)

addApplicationOptionAction(action)

Add a display option to the ribbon.

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.

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)

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, QAction, QMenu)

insertSeparator(self, QAction)

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.

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, QAction)

setApplicationIcon(icon)

Set the application icon.

setCollapseButtonIcon(icon)

Set the icon of the min button.

setCornerWidget(self, QWidget[, corner])

setCurrentCategory(category)

Set the current category.

setDefaultUp(self, bool)

setHelpButtonIcon(icon)

Set the icon of the help button.

setNativeMenuBar(self, bool)

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.

setTabBarHeight([height])

Set the height of the tab bar.

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.

tabBarHeight()

Get the height of the tab bar.

title()

Return the title of the ribbon.

helpButtonClicked

actionAt(self, QPoint) QAction[source]
actionGeometry(self, QAction) QRect[source]
activeAction(self) QAction[source]
addAction(self, QAction)[source]
addAction(self, str) QAction
addAction(self, str, PYQT_SLOT) QAction
addApplicationOptionAction(action: QAction)[source]

Add a display option to the ribbon.

Parameters

action – The action of the display option.

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: Optional[Union[QColor, GlobalColor]] = None) 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: Optional[Union[QColor, GlobalColor]] = None) 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.

addMenu(self, QMenu) QAction[source]
addMenu(self, str) QMenu
addMenu(self, QIcon, 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]
applicationOptionButton() QToolButton[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.

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, QAction, QMenu) QAction[source]
insertSeparator(self, QAction) QAction[source]
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.

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, 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, QWidget, corner: Corner = Qt.TopRightCorner)[source]
setCurrentCategory(category: RibbonCategory)[source]

Set the current category.

Parameters

category – The category to set.

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

Set the icon of the help button.

Parameters

icon – The icon to set.

setNativeMenuBar(self, bool)[source]
setQuickAccessButtonHeight(height: int = 40)[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.

setTabBarHeight(height: int = 50)[source]

Set the height of the tab bar.

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.

tabBarHeight() int[source]

Get the height of the tab bar.

Returns

The height of the tab bar.

title() str[source]

Return the title of the ribbon.

Returns

The title of the ribbon.

Ribbon Title

RibbonApplicationButton

class ribbon.titlewidget.RibbonApplicationButton[source]

Bases: QToolButton

Application button in the ribbon bar.

RibbonTabBar

class ribbon.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 ribbon.titlewidget.RibbonTitleLabel[source]

Bases: QLabel

Title label in the ribbon bar.

RibbonTitleWidget

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

Bases: QFrame

The title widget of the ribbon.

Methods

addApplicationOptionAction(action)

Add a display option to the category.

addQuickAccessButton(button)

Add a widget to the quick access bar.

addRightToolButton(button)

Add a widget to the right button bar.

applicationButton()

Return the application button.

applicationMenu()

Return the application menu.

collapseRibbonButton()

Return the collapse ribbon button.

helpRibbonButton()

Return the help ribbon button.

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.

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.

setTabBarHeight([height])

Set the height of the tab bar.

setTitle(title)

Set the title of the ribbon.

tabBar()

Return the tab bar of the ribbon.

tabBarHeight()

Get the height of the tab bar.

title()

Return the title of the ribbon.

collapseRibbonButtonClicked

helpButtonClicked

addApplicationOptionAction(action: QAction)[source]

Add a display option to the category.

Parameters

action – The action of the display option.

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.

applicationButton() RibbonApplicationButton[source]

Return the application button.

applicationMenu() QMenu[source]

Return the application menu.

Returns

The application menu.

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.

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.

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 = 40)[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.

setTabBarHeight(height: int = 50)[source]

Set the height of the tab bar.

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.

tabBarHeight() int[source]

Get the height of the tab bar.

Returns

The height of the tab bar.

title() str[source]

Return the title of the ribbon.

Returns

The title of the ribbon.

Ribbon Category

RibbonCategory

class ribbon.category.RibbonCategory(title: str = '', style: RibbonCategoryStyle = RibbonCategoryStyle.Normal, color: QColor = None, parent=None)[source]
class ribbon.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.

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.

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.

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.

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 ribbon.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 ribbon.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 ribbon.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 ribbon.category.RibbonCategoryStyle(value)[source]

Bases: IntEnum

The button style of a category.

RibbonCategoryScrollArea

class ribbon.categorylayoutwidget.RibbonCategoryScrollArea[source]

Bases: QScrollArea

Scroll area for the gallery

RibbonCategoryScrollAreaContents

class ribbon.categorylayoutwidget.RibbonCategoryScrollAreaContents[source]

Bases: QFrame

Scroll area contents for the gallery

RibbonCategoryLayoutButton

class ribbon.categorylayoutwidget.RibbonCategoryLayoutButton[source]

Bases: QToolButton

Previous/Next buttons in the category when the size is not enough for the widgets.

RibbonCategoryLayoutWidget

class ribbon.categorylayoutwidget.RibbonCategoryLayoutWidget(parent=None)[source]

Bases: QFrame

The category layout widget’s category scroll area to arrange the widgets in the category.

Methods

addWidget(widget)

Add a widget to the category layout.

autoSetScrollButtonsVisible()

Set the visibility of the scroll buttons.

paintEvent(a0)

Override the paint event to draw the background.

removeWidget(widget)

Remove a widget from the category layout.

resizeEvent(a0)

Override the resize event to resize the scroll area.

scrollNext()

Scroll the category to the next widget.

scrollPrevious()

Scroll the category to the previous widget.

takeWidget(widget)

Remove and return a widget from the category layout.

displayOptionsButtonClicked

addWidget(widget: QWidget)[source]

Add a widget to the category layout.

Parameters

widget – The widget to add.

autoSetScrollButtonsVisible()[source]

Set the visibility of the scroll buttons.

paintEvent(a0: QPaintEvent) None[source]

Override the paint event to draw the background.

removeWidget(widget: QWidget)[source]

Remove a widget from the category layout.

Parameters

widget – The widget to remove.

resizeEvent(a0: QResizeEvent) None[source]

Override the resize event to resize the scroll area.

scrollNext()[source]

Scroll the category to the next widget.

scrollPrevious()[source]

Scroll the category to the previous widget.

takeWidget(widget: QWidget) QWidget[source]

Remove and return a widget from the category layout.

Parameters

widget – The widget to remove.

Returns

The widget that was removed.

Ribbon Panel

RibbonPanel

class ribbon.panel.RibbonPanel(title: str = '', maxRows: int = 6, showPanelOptionButton=True, parent=None)[source]
class ribbon.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, alignment])

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, alignment])

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, alignment])

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, alignment])

Add a spin box to the panel.

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

Add a table widget to the panel.

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

Add a text edit to the panel.

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

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.

panelOptionButton()

Return the panel option button.

removeWidget(widget)

Remove a widget from the panel.

rowHeight()

Return the height of a row.

setPanelOptionToolTip(text)

Set the tooltip of the panel option button.

setTitle(title)

Set the title of the panel.

title()

Get the title of the panel.

widget(index)

Get the widget at the given index.

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) 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.

Returns

The button that was added.

addCalendarWidget(rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The calendar widget that was added.

addComboBox(items: List[str], rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The combo box that was added.

addDateEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The date edit that was added.

addDateTimeEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The date time edit that was added.

addDoubleSpinBox(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The double spin box that was added.

addFontComboBox(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The combo box that was added.

addGallery(minimumWidth=800, popupHideOnClick=False, rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The gallery.

addHorizontalSeparator(width=6, rowSpan: int = 1, colSpan: int = 2, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The separator.

addLabel(text: str, rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

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) 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.

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) 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.

Returns

The button that was added.

addLargeWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132)[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.

addLineEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The line edit that was added.

addListWidget(rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

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) 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.

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) 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.

Returns

The button that was added.

addMediumWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132)[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.

addPlainTextEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The text edit that was added.

addProgressBar(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The progress bar that was added.

addSeparator(orientation=2, width=6, rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The separator.

addSlider(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

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) 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.

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) 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.

Returns

The button that was added.

addSmallWidget(widget: QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=132)[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.

Returns

The widget that was added.

addSpinBox(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The spin box that was added.

addTableWidget(rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The table widget that was added.

addTextEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The text edit that was added.

addTimeEdit(rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

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) 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.

Returns

The button that was added.

addTreeWidget(rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The tree widget that was added.

addVerticalSeparator(width=6, rowSpan: int = 6, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132) 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.

Returns

The separator.

addWidget(widget: QWidget, rowSpan: int = 2, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=132)[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.

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.

setPanelOptionToolTip(text: str)[source]

Set the tooltip of the panel option button.

Parameters

text – The tooltip text.

setTitle(title: str)[source]

Set the title of the panel.

Parameters

title – The title to set.

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.

RibbonPanelItemWidget

class ribbon.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 ribbon.panel.RibbonSpaceFindMode(value)[source]

Bases: IntEnum

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

RibbonGridLayoutManager

class ribbon.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 ribbon.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.

setButtonStyle(style)

Set the button style 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.

setButtonStyle(style: RibbonButtonStyle)[source]

Set the button style of the button.

Parameters

style – The button style of the button.

RibbonButtonStyle

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

Bases: IntEnum

Button style, Small, Medium, or Large.

Ribbon Separator

RibbonSeparator

class ribbon.separator.RibbonSeparator(orientation=QtCore.Qt.Vertical, width=6, parent=None)[source]
class ribbon.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 ribbon.separator.RibbonHorizontalSeparator(width: int = 6, parent=None)[source]

Bases: RibbonSeparator

Horizontal separator.

RibbonVerticalSeparator

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

Bases: RibbonSeparator

Vertical separator.

Ribbon Menu

RibbonMenu

class ribbon.menu.RibbonMenu(title: str = '', parent=None)[source]
class ribbon.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 ribbon.menu.RibbonPermanentMenu(title: str = '', parent=None)[source]
class ribbon.menu.RibbonPermanentMenu(parent=None)

Bases: RibbonMenu

A permanent menu.

Methods

actionEvent(self, QActionEvent)

hideEvent(self, QHideEvent)

actionAdded

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