Welcome to PyQtRibbon’s documentation!
Ribbon Bar for PyQt or PySide applications.
GitHub Repository: github.com/haiiliin/pyqtribbon.
PyPI: pypi.org/project/pyqtribbon.
Documentation: pyqtribbon.haiiliin.com/en/stable.
Read the Docs: readthedocs.org/projects/pyqtribbon.
Getting Started
Installation
PyQtRibbon is distribued to PyPI, you can use pip to install it:
pip install pyqtribbon
You can also install the package from source:
pip install git+https://github.com/haiiliin/pyqtribbon.git@main
The Ribbon Bar
Introduction
The ribbon is first introduced by Microsoft in the 2000’s. It is a toolbar with a tabbed interface. According to Microsoft:
Note
A ribbon is a user interface (UI) element that organizes commands into logical groups. These groups appear on separate tabs in a strip across the top of the window. The ribbon replaces the menu bar and toolbars. A ribbon can significantly improve application usability. For more information, see Ribbons. The following illustration shows a ribbon. A ribbon can significantly improve application usability. For more information, see Ribbons. The following illustration shows a ribbon.

Definitions of Ribbon Elements

Application button: The button that appears on the upper-left corner of a ribbon. The Application button replaces the File menu and is visible even when the ribbon is minimized. When the button is clicked, a menu that has a list of commands is displayed.
Quick Access toolbar: A small, customizable toolbar that displays frequently used commands.
Category: The logical grouping that represents the contents of a ribbon tab.
Category Default button: The button that appears on the ribbon when the ribbon is minimized. When the button is clicked, the category reappears as a menu.
Panel: An area of the ribbon bar that displays a group of related controls. Every ribbon category contains one or more ribbon panels.
Ribbon elements: Controls in the panels, for example, buttons and combo boxes. To see the various controls that can be hosted on a ribbon, see RibbonGadgets Sample: Ribbon Gadgets Application.
Ribbon Elements in PyQtRibbon

User Manual
The RibbonScreenShotWindow Class
The RibbonScreenShotWindow
class is just for taking a screenshot of the window,
the window will be closed 0.1s after it is shown. It is just used for documenting the window.
- class pyqtribbon.screenshotwindow.RibbonScreenShotWindow(fileName: str = 'shot.jpg', *args, **kwargs)[source]
This class is just for taking a screenshot of the window, the window will be closed 0.1s after it is shown.
Initialize the class.
- Parameters:
fileName – The file name for the screenshot.
- setScreenShotFileName(fileName: str)[source]
Set the file name for the screenshot.
- Parameters:
fileName – The file name for the screenshot.
- takeScreenShot()[source]
Take a screenshot of the window.
Instantiate a Ribbon Bar
RibbonBar
is inherited from QMenuBar
,
you can use the setMenuBar method of QMainWindow
to set the ribbon bar as the main menu bar.
from pyqtribbon import RibbonBar
window = QtWidgets.QMainWindow()
ribbon = RibbonBar()
window.setMenuBar(ribbon)
Example
For example, using the following code,
import sys
from qtpy import QtWidgets, QtGui
from pyqtribbon import RibbonBar
from pyqtribbon.screenshotwindow import RibbonScreenShotWindow
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
app.setFont(QtGui.QFont("Times New Roman", 8))
window = RibbonScreenShotWindow('ribbonbar.png')
# Ribbon bar
ribbonbar = RibbonBar()
window.setMenuBar(ribbonbar)
# Show the window
window.resize(1000, 250)
window.show()
sys.exit(app.exec_())
You can get a window like this:

Customize Ribbon Bar
General Setups
|
Set the style of the ribbon. |
Get the total height of the ribbon. |
|
|
Set the total height of the ribbon. |
Show the ribbon. |
|
Hide the ribbon. |
|
Get the visibility of the ribbon. |
|
|
Set the visibility of the ribbon. |
Setup Title
Return the title of the ribbon. |
|
|
Set the title of the ribbon. |
|
Add a widget to the title widget. |
|
Insert a widget to the title widget. |
|
Remove a widget from the title widget. |
Setup Category Tab Bar
Return the tab bar of the ribbon. |
Setup Quick Access Bar
Return the quick access toolbar of the ribbon. |
|
|
Add a button to the quick access bar. |
|
Set the height of the quick access buttons. |
Setup Right Tool Bar
Return the right toolbar of the ribbon. |
|
|
Add a widget to the right button bar. |
|
Set the height of the right buttons. |
Set the icon of the help button. |
|
Remove the help button from the ribbon. |
|
Signal, the help button was clicked. |
|
Return the collapse ribbon button. |
|
Set the icon of the min button. |
|
Remove the min button from the ribbon. |
Example
For example, using the following code,
import sys
from qtpy import QtGui
from qtpy.QtWidgets import QApplication, QToolButton
from pyqtribbon import RibbonBar
from pyqtribbon.screenshotwindow import RibbonScreenShotWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setFont(QtGui.QFont("Times New Roman", 8))
window = RibbonScreenShotWindow('ribbonbar-customize.png')
# Ribbon bar
ribbonbar = RibbonBar()
window.setMenuBar(ribbonbar)
# Title of the ribbon
ribbonbar.setTitle('This is my custom title')
# Quick Access Bar
qbutton = QToolButton()
qbutton.setText('Quick Button')
ribbonbar.addQuickAccessButton(qbutton)
# Right toolbar
rbutton = QToolButton()
rbutton.setText('Right Button')
ribbonbar.addRightToolButton(rbutton)
# Show the window
window.resize(1000, 250)
window.show()
sys.exit(app.exec_())
You can get a window like this:

Manage Categories
Return a list of categories of the ribbon. |
|
|
Add a new category to the ribbon. |
Add categories from a dict. |
|
|
Add a new category to the ribbon. |
|
Add a new context category to the ribbon. |
|
Add a group of context categories with the same tab color to the ribbon. |
|
Show the given category or categories, if it is not a context category, nothing happens. |
|
Hide the given category or categories, if it is not a context category, nothing happens. |
|
Remove a category from the ribbon. |
|
Set the current category. |
Return the current category. |
|
Show category by tab index |
Customize Categories
Setup Styles
Return the button style of the category. |
|
Set the button style of the category. |
Manage Panels
|
Add a new panel to the category. |
Add panels from a dictionary. |
|
|
Remove a panel from the category. |
|
Remove and return a panel from the category. |
|
Return a panel from the category. |
Return all panels in the category. |
Example
For example, using the following code,
import sys
from qtpy import QtGui
from qtpy.QtWidgets import QApplication
from qtpy.QtGui import QIcon
from pyqtribbon import RibbonBar, RibbonCategoryStyle
from pyqtribbon.screenshotwindow import RibbonScreenShotWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setFont(QtGui.QFont("Times New Roman", 8))
window = RibbonScreenShotWindow('category.png')
# Ribbon bar
ribbonbar = RibbonBar()
window.setMenuBar(ribbonbar)
# Categories
category1 = ribbonbar.addCategory('Category 1')
panel1 = category1.addPanel('Panel 1')
panel1.addLargeButton('Large Button 1', QIcon('python.png'))
category2 = ribbonbar.addContextCategory('Category 2')
panel12 = category2.addPanel('Panel 2')
panel12.addLargeButton('Large Button 2', QIcon('python.png'))
categories = ribbonbar.addCategoriesBy({
'Category 6': {
"style": RibbonCategoryStyle.Normal,
"panels": {
"Panel 1": {
"showPanelOptionButton": True,
"widgets": {
"Button 1": {
"type": "Button",
"arguments": {
"icon": QIcon("python.png"),
"text": "Button",
"tooltip": "This is a tooltip",
}
},
}
},
}
}
})
ribbonbar.setCurrentCategory(categories['Category 6'])
# Show the window
window.resize(1000, 250)
window.show()
sys.exit(app.exec_())
You can get a window like this:

Customize Panels
Setup Title Label
Get the title of the panel. |
|
|
Set the title of the panel. |
Add Widgets to Panels
|
Add a widget to the panel. |
|
Add widgets to the panel. |
|
Remove a widget from the panel. |
|
Get the widget at the given index. |
Get all the widgets in the panel. |
|
|
Add a small widget to the panel. |
|
Add a medium widget to the panel. |
|
Add a large widget to the panel. |
|
Add a button to the panel. |
|
Add a small button to the panel. |
|
Add a medium button to the panel. |
|
Add a large button to the panel. |
|
Add a toggle button to the panel. |
|
Add a small toggle button to the panel. |
|
Add a medium toggle button to the panel. |
|
Add a large toggle button to the panel. |
|
Add a combo box to the panel. |
|
Add a font combo box to the panel. |
|
Add a line edit to the panel. |
|
Add a text edit to the panel. |
|
Add a plain text edit to the panel. |
|
Add a label to the panel. |
|
Add a progress bar to the panel. |
|
Add a slider to the panel. |
|
Add a spin box to the panel. |
|
Add a double spin box to the panel. |
|
Add a date edit to the panel. |
|
Add a time edit to the panel. |
|
Add a date time edit to the panel. |
|
Add a table widget to the panel. |
|
Add a tree widget to the panel. |
|
Add a list widget to the panel. |
|
Add a calendar widget to the panel. |
|
Add a separator to the panel. |
|
Add a horizontal separator to the panel. |
|
Add a vertical separator to the panel. |
|
Add a gallery to the panel. |
Example
For example, using the following code,
import sys
from qtpy import QtGui
from qtpy.QtWidgets import QApplication, QToolButton, QMenu, QLabel, QLineEdit
from qtpy.QtGui import QIcon
from qtpy.QtCore import Qt
from pyqtribbon import RibbonBar
from pyqtribbon.screenshotwindow import RibbonScreenShotWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setFont(QtGui.QFont("Times New Roman", 8))
window = RibbonScreenShotWindow('panel.png')
# Ribbon bar
ribbonbar = RibbonBar()
window.setMenuBar(ribbonbar)
category1 = ribbonbar.addCategory("Category 1")
panel = category1.addPanel("Panel 1", showPanelOptionButton=False)
panel.addSmallButton("Button 1", icon=QIcon("python.png"))
panel.addSmallButton("Button 2", icon=QIcon("python.png"))
panel.addSmallButton("Button 3", icon=QIcon("python.png"))
panel.addMediumToggleButton("Show/Hide Category 2", icon=QIcon("python.png"))
panel.addVerticalSeparator()
panel.addMediumToggleButton("Show/Hide Category 3", icon=QIcon("python.png"))
panel.addMediumToggleButton("Show/Hide Category 4/5", icon=QIcon("python.png"),
colSpan=2, alignment=Qt.AlignLeft)
panel.addLargeButton("Button 4", icon=QIcon("python.png"))
panel.addVerticalSeparator()
panel.addMediumButton("Button 5", icon=QIcon("python.png"))
panel.addMediumButton("Button 6", icon=QIcon("python.png"))
button = panel.addLargeButton("Button 7", icon=QIcon("python.png"))
menu = QMenu()
menu.addAction(QIcon("python.png"), "Action 1")
menu.addAction(QIcon("python.png"), "Action 2")
menu.addAction(QIcon("python.png"), "Action 3")
button.setMenu(menu)
button.setPopupMode(QToolButton.InstantPopup)
panel.addWidget(button, rowSpan=6)
gallery = panel.addGallery(minimumWidth=500, popupHideOnClick=True)
for i in range(100):
gallery.addToggleButton(f'item {i+1}', QIcon("python.png"))
popupMenu = gallery.popupMenu()
submenu = popupMenu.addMenu(QIcon("python.png"), 'Submenu')
submenu.addAction(QIcon("python.png"), "Action 4")
popupMenu.addAction(QIcon("python.png"), "Action 1")
popupMenu.addAction(QIcon("python.png"), "Action 2")
popupMenu.addSeparator()
popupMenu.addWidget(QLabel("This is a custom widget"))
formLayout = popupMenu.addFormLayoutWidget()
formLayout.addRow(QLabel("Row 1"), QLineEdit())
# Show the window
window.resize(1300, 250)
window.show()
sys.exit(app.exec_())
You can get a window like this:

A Complete Example
The following code snippet is a complete example.
import sys
from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QVBoxLayout
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import Qt
from pyqtribbon import RibbonBar
from pyqtribbon.screenshotwindow import RibbonScreenShotWindow
from pyqtribbon.utils import data_file_path
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setFont(QFont("Times New Roman", 8))
# Central widget
window = RibbonScreenShotWindow('tutorial-ribbonbar.png')
window.setWindowIcon(QIcon(data_file_path("icons/python.png")))
centralWidget = QWidget()
window.setCentralWidget(centralWidget)
layout = QVBoxLayout(centralWidget)
# Ribbon bar
ribbonbar = RibbonBar()
window.setMenuBar(ribbonbar)
category = ribbonbar.addCategory("Category 1")
panel = category.addPanel("Panel 1")
panel.addLargeButton("A Large Button", QIcon(data_file_path("icons/python.png")))
panel.addMediumButton("A Medium Button", QIcon(data_file_path("icons/python.png")))
panel.addMediumButton("A Medium Button", QIcon(data_file_path("icons/python.png")))
panel.addSmallButton("A Small Button", QIcon(data_file_path("icons/python.png")))
panel.addSmallButton("A Small Button", QIcon(data_file_path("icons/python.png")))
panel.addSmallButton("A Small Button", QIcon(data_file_path("icons/python.png")))
# Display a label in the main window
label = QLabel("Ribbon Test Window")
label.setFont(QFont("Arial", 20))
label.setAlignment(Qt.AlignCenter)
# Add the ribbon bar and label to the layout
layout.addWidget(label, 1)
# Show the window
window.resize(1800, 350)
window.show()
sys.exit(app.exec_())
You can get a window like this:

API Reference
This page contains auto-generated API reference documentation [1].
pyqtribbon
Submodules
pyqtribbon.category
Module Contents
Classes
The button style of a category. |
|
Previous/Next buttons in the category when the |
|
Scroll area for the gallery |
|
Scroll area contents for the gallery |
|
The category layout widget's category scroll area to arrange the widgets in the category. |
|
The RibbonCategory is the logical grouping that represents the contents of a ribbon tab. |
|
A normal category. |
|
A context category. |
|
A list of context categories. |
Attributes
- class pyqtribbon.category.RibbonCategoryStyle[source]
Bases:
enum.IntEnum
The button style of a category.
- class pyqtribbon.category.RibbonCategoryLayoutButton[source]
Bases:
qtpy.QtWidgets.QToolButton
Previous/Next buttons in the category when the size is not enough for the widgets.
- class pyqtribbon.category.RibbonCategoryScrollArea[source]
Bases:
qtpy.QtWidgets.QScrollArea
Scroll area for the gallery
- class pyqtribbon.category.RibbonCategoryScrollAreaContents[source]
Bases:
qtpy.QtWidgets.QFrame
Scroll area contents for the gallery
- class pyqtribbon.category.RibbonCategoryLayoutWidget(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
The category layout widget’s category scroll area to arrange the widgets in the category.
- paintEvent(a0: qtpy.QtGui.QPaintEvent) None [source]
Override the paint event to draw the background.
- resizeEvent(a0: qtpy.QtGui.QResizeEvent) None [source]
Override the resize event to resize the scroll area.
- addWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the category layout.
- Parameters:
widget – The widget to add.
- class pyqtribbon.category.RibbonCategory(title: str = '', style: RibbonCategoryStyle = RibbonCategoryStyle.Normal, color: qtpy.QtGui.QColor = None, parent=None) RibbonCategory(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
The RibbonCategory is the logical grouping that represents the contents of a ribbon tab.
- _ribbon: pyqtribbon.typehints.RibbonType | None[source]
- _style: RibbonCategoryStyle[source]
- _panels: Dict[str, pyqtribbon.panel.RibbonPanel][source]
- setMaximumRows(rows: int)[source]
Set the maximum number of rows.
- Parameters:
rows – The maximum number of rows.
- setCategoryStyle(style: RibbonCategoryStyle)[source]
Set the button style of the category.
- Parameters:
style – The button style.
- categoryStyle() RibbonCategoryStyle [source]
Return the button style of the category.
- Returns:
The button style.
- addPanelsBy(data: Dict[str, Dict]) Dict[str, pyqtribbon.panel.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.
- addPanel(title: str, showPanelOptionButton=True) pyqtribbon.panel.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.
- removePanel(title: str)[source]
Remove a panel from the category.
- Parameters:
title – The title of the panel.
- takePanel(title: str) pyqtribbon.panel.RibbonPanel [source]
Remove and return a panel from the category.
- Parameters:
title – The title of the panel.
- Returns:
The removed panel.
- panel(title: str) pyqtribbon.panel.RibbonPanel [source]
Return a panel from the category.
- Parameters:
title – The title of the panel.
- Returns:
The panel.
- panels() Dict[str, pyqtribbon.panel.RibbonPanel] [source]
Return all panels in the category.
- Returns:
The panels.
- class pyqtribbon.category.RibbonNormalCategory(title: str, parent: qtpy.QtWidgets.QWidget)[source]
Bases:
RibbonCategory
A normal category.
- setCategoryStyle(style: RibbonCategoryStyle)[source]
Set the button style of the category.
- Parameters:
style – The button style.
- class pyqtribbon.category.RibbonContextCategory(title: str, color: qtpy.QtGui.QColor, parent: qtpy.QtWidgets.QWidget)[source]
Bases:
RibbonCategory
A context category.
- setCategoryStyle(style: RibbonCategoryStyle)[source]
Set the button style of the category.
- Parameters:
style – The button style.
- color() qtpy.QtGui.QColor [source]
Return the color of the context category.
- Returns:
The color of the context category.
- setColor(color: qtpy.QtGui.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.
- hideContextCategory()[source]
Hide the given category, if it is not a context category, nothing happens.
- class pyqtribbon.category.RibbonContextCategories(name: str, color: qtpy.QtGui.QColor, categories: Dict[str, RibbonContextCategory], ribbon)[source]
Bases:
Dict
[str
,RibbonContextCategory
]A list of context categories.
pyqtribbon.gallery
Module Contents
Classes
The popup widget for the gallery widget. |
|
Gallery list widget. |
|
Gallery button. |
|
Gallery popup list widget. |
|
A widget that displays a gallery of buttons. |
- class pyqtribbon.gallery.RibbonPopupWidget[source]
Bases:
qtpy.QtWidgets.QFrame
The popup widget for the gallery widget.
- class pyqtribbon.gallery.RibbonGalleryListWidget(parent=None)[source]
Bases:
qtpy.QtWidgets.QListWidget
Gallery list widget.
- class pyqtribbon.gallery.RibbonGalleryButton[source]
Bases:
qtpy.QtWidgets.QToolButton
Gallery button.
- class pyqtribbon.gallery.RibbonGalleryPopupListWidget(parent=None)[source]
Bases:
RibbonGalleryListWidget
Gallery popup list widget.
- class pyqtribbon.gallery.RibbonGallery(minimumWidth=800, popupHideOnClick=False, parent=None) RibbonGallery(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
A widget that displays a gallery of buttons.
- _buttons: List[pyqtribbon.toolbutton.RibbonToolButton] = [][source]
- _popupButtons: List[pyqtribbon.toolbutton.RibbonToolButton] = [][source]
- popupMenu() pyqtribbon.menu.RibbonPermanentMenu [source]
Return the popup menu.
- setPopupWindowSize(size: qtpy.QtCore.QSize)[source]
Set the size of the popup window
- Parameters:
size – size of the popup window
- _addWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the gallery
- Parameters:
widget – widget to add
- _addPopupWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the popup gallery
- Parameters:
widget – widget to add
- setPopupHideOnClick(popupHideOnClick: bool)[source]
Set the hide on click flag
- Parameters:
popupHideOnClick – hide on click flag
- addButton(text: str = None, icon: qtpy.QtGui.QIcon = None, slot=None, shortcut=None, tooltip=None, statusTip=None, checkable=False) pyqtribbon.toolbutton.RibbonToolButton [source]
Add a button to the gallery
- Parameters:
text – text of the button
icon – icon of the button
slot – slot to call when the button is clicked
shortcut – shortcut of the button
tooltip – tooltip of the button
statusTip – status tip of the button
checkable – checkable flag of the button
- Returns:
the button added
- addToggleButton(text: str = None, icon: qtpy.QtGui.QIcon = None, slot=None, shortcut=None, tooltip=None, statusTip=None) pyqtribbon.toolbutton.RibbonToolButton [source]
Add a toggle button to the gallery
- Parameters:
text – text of the button
icon – icon of the button
slot – slot to call when the button is clicked
shortcut – shortcut of the button
tooltip – tooltip of the button
statusTip – status tip of the button
- Returns:
the button added
pyqtribbon.panel
Module Contents
Classes
Widget to display the title of a panel. |
|
Mode to find available space in a grid layout, ColumnWise or RowWise. |
|
Grid Layout Manager. |
|
Widget to display a panel item. |
|
Button to display the options of a panel. |
|
Panel in the ribbon category. |
Attributes
- class pyqtribbon.panel.RibbonPanelTitle[source]
Bases:
qtpy.QtWidgets.QLabel
Widget to display the title of a panel.
- class pyqtribbon.panel.RibbonSpaceFindMode[source]
Bases:
enum.IntEnum
Mode to find available space in a grid layout, ColumnWise or RowWise.
- class pyqtribbon.panel.RibbonGridLayoutManager(rows: int)[source]
Bases:
object
Grid Layout Manager.
- 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.
- class pyqtribbon.panel.RibbonPanelItemWidget(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
Widget to display a panel item.
- class pyqtribbon.panel.RibbonPanelOptionButton[source]
Bases:
qtpy.QtWidgets.QToolButton
Button to display the options of a panel.
- class pyqtribbon.panel.RibbonPanel(title: str = '', maxRows: int = 6, showPanelOptionButton=True, parent=None) RibbonPanel(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
Panel in the ribbon category.
- _gridLayoutManager: RibbonGridLayoutManager[source]
- maximumRows() int [source]
Return the maximal number of rows in the panel.
- Returns:
The maximal number of rows in the panel.
- largeRows() int [source]
Return the number of span rows for large widgets.
- Returns:
The number of span rows for large widgets.
- mediumRows() int [source]
Return the number of span rows for medium widgets.
- Returns:
The number of span rows for medium widgets.
- smallRows() int [source]
Return the number of span rows for small widgets.
- Returns:
The number of span rows for small widgets.
- setMaximumRows(maxRows: int)[source]
Set the maximal number of rows in the panel.
- Parameters:
maxRows – The maximal number of rows in the panel.
- setLargeRows(rows: int)[source]
Set the number of span rows for large widgets.
- Parameters:
rows – The number of span rows for large widgets.
- setMediumRows(rows: int)[source]
Set the number of span rows for medium widgets.
- Parameters:
rows – The number of span rows for medium widgets.
- setSmallRows(rows: int)[source]
Set the number of span rows for small widgets.
- Parameters:
rows – The number of span rows for small widgets.
- defaultRowSpan(rowSpan: int | pyqtribbon.toolbutton.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.
- panelOptionButton() RibbonPanelOptionButton [source]
Return the panel option button.
- Returns:
The panel option button.
- setPanelOptionToolTip(text: str)[source]
Set the tooltip of the panel option button.
- Parameters:
text – The tooltip text.
- addWidgetsBy(data: Dict[str, Dict]) Dict[str, qtpy.QtWidgets.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.
- addWidget(widget: qtpy.QtWidgets.QWidget, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: 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.
- addSmallWidget(widget: qtpy.QtWidgets.QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: 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.
- addMediumWidget(widget: qtpy.QtWidgets.QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: 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.
- addLargeWidget(widget: qtpy.QtWidgets.QWidget, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: 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.
- widget(index: int) qtpy.QtWidgets.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[qtpy.QtWidgets.QWidget] [source]
Get all the widgets in the panel.
- Returns:
A list of all the widgets in the panel.
- addButton(text: str = None, icon: qtpy.QtGui.QIcon = None, style: pyqtribbon.toolbutton.RibbonButtonStyle = RibbonButtonStyle.Large, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addSmallButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addMediumButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addLargeButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addToggleButton(text: str = None, icon: qtpy.QtGui.QIcon = None, style: pyqtribbon.toolbutton.RibbonButtonStyle = RibbonButtonStyle.Large, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addSmallToggleButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addMediumToggleButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addLargeToggleButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, colSpan: int = 1, slot=None, shortcut=None, tooltip=None, statusTip=None, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.toolbutton.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.
- addComboBox(items: List[str], rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addFontComboBox(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addLineEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addTextEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addPlainTextEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addLabel(text: str, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addProgressBar(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addSlider(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addSpinBox(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addDoubleSpinBox(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addDateEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addTimeEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addDateTimeEdit(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addTableWidget(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addTreeWidget(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addListWidget(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addCalendarWidget(rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) qtpy.QtWidgets.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.
- addSeparator(orientation=QtCore.Qt.Vertical, width=6, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.separator.RibbonHorizontalSeparator | pyqtribbon.separator.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.
- addHorizontalSeparator(width=6, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Small, colSpan: int = 2, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.separator.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.
- addVerticalSeparator(width=6, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.separator.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.
- addGallery(minimumWidth=800, popupHideOnClick=False, rowSpan: int | pyqtribbon.toolbutton.RibbonButtonStyle = Large, colSpan: int = 1, mode=RibbonSpaceFindMode.ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: bool | float = False) pyqtribbon.gallery.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.
pyqtribbon.ribbonbar
Module Contents
Classes
Enum where members are also (and must be) ints |
|
Stacked widget that is used to display the ribbon. |
|
The RibbonBar class is the top level widget that contains the ribbon. |
Attributes
- class pyqtribbon.ribbonbar.RibbonStyle[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- class pyqtribbon.ribbonbar.RibbonStackedWidget(parent=None)[source]
Bases:
qtpy.QtWidgets.QStackedWidget
Stacked widget that is used to display the ribbon.
- class pyqtribbon.ribbonbar.RibbonBar(title: str = '', maxRows=6, parent=None) RibbonBar(parent=None)[source]
Bases:
qtpy.QtWidgets.QMenuBar
The RibbonBar class is the top level widget that contains the ribbon.
- _categories: Dict[str, pyqtribbon.category.RibbonCategory][source]
- setRibbonStyle(style: RibbonStyle)[source]
Set the style of the ribbon.
- Parameters:
style – The style to set.
- applicationOptionButton() pyqtribbon.titlewidget.RibbonApplicationButton [source]
Return the application button.
- setApplicationIcon(icon: qtpy.QtGui.QIcon)[source]
Set the application icon.
- Parameters:
icon – The icon to set.
- addTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the title widget.
- Parameters:
widget – The widget to add.
- removeTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Remove a widget from the title widget.
- Parameters:
widget – The widget to remove.
- insertTitleWidget(index: int, widget: qtpy.QtWidgets.QWidget)[source]
Insert a widget to the title widget.
- Parameters:
index – The index to insert the widget.
widget – The widget to insert.
- addFileMenu() pyqtribbon.menu.RibbonMenu [source]
Add a file menu to the ribbon.
- setRibbonHeight(height: int)[source]
Set the total height of the ribbon.
- Parameters:
height – The height to set.
- tabBar() pyqtribbon.tabbar.RibbonTabBar [source]
Return the tab bar of the ribbon.
- Returns:
The tab bar of the ribbon.
- quickAccessToolBar() qtpy.QtWidgets.QToolBar [source]
Return the quick access toolbar of the ribbon.
- Returns:
The quick access toolbar of the ribbon.
- addQuickAccessButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a button to the quick access bar.
- Parameters:
button – The button to add.
- setQuickAccessButtonHeight(height: int = 30)[source]
Set the height of the quick access buttons.
- Parameters:
height – The height to set.
- rightToolBar() qtpy.QtWidgets.QToolBar [source]
Return the right toolbar of the ribbon.
- Returns:
The right toolbar of the ribbon.
- addRightToolButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a widget to the right button bar.
- Parameters:
button – The button to add.
- setRightToolBarHeight(height: int = 24)[source]
Set the height of the right buttons.
- Parameters:
height – The height to set.
- helpRibbonButton() qtpy.QtWidgets.QToolButton [source]
Return the help button of the ribbon.
- Returns:
The help button of the ribbon.
- setHelpButtonIcon(icon: qtpy.QtGui.QIcon)[source]
Set the icon of the help button.
- Parameters:
icon – The icon to set.
- collapseRibbonButton() qtpy.QtWidgets.QToolButton [source]
Return the collapse ribbon button.
- Returns:
The collapse ribbon button.
- setCollapseButtonIcon(icon: qtpy.QtGui.QIcon)[source]
Set the icon of the min button.
- Parameters:
icon – The icon to set.
- category(name: str) pyqtribbon.category.RibbonCategory [source]
Return the category with the given name.
- Parameters:
name – The name of the category.
- Returns:
The category with the given name.
- categories() Dict[str, pyqtribbon.category.RibbonCategory] [source]
Return a list of categories of the ribbon.
- Returns:
A dict of categories of the ribbon.
- addCategoriesBy(data: Dict[str, Dict]) Dict[str, pyqtribbon.category.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: qtpy.QtGui.QColor = None) pyqtribbon.category.RibbonNormalCategory | pyqtribbon.category.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.
- addNormalCategory(title: str) pyqtribbon.category.RibbonNormalCategory [source]
Add a new category to the ribbon.
- Parameters:
title – The title of the category.
- Returns:
The newly created category.
- addContextCategory(title: str, color: qtpy.QtGui.QColor | qtpy.QtCore.Qt.GlobalColor = QtCore.Qt.blue) pyqtribbon.category.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.
- addContextCategories(name: str, titles: List[str], color: qtpy.QtGui.QColor | qtpy.QtCore.Qt.GlobalColor = QtCore.Qt.blue) pyqtribbon.category.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.
- showContextCategory(category: pyqtribbon.category.RibbonContextCategory | pyqtribbon.category.RibbonContextCategories)[source]
Show the given category or categories, if it is not a context category, nothing happens.
- Parameters:
category – The category to show.
- hideContextCategory(category: pyqtribbon.category.RibbonContextCategory | pyqtribbon.category.RibbonContextCategories)[source]
Hide the given category or categories, if it is not a context category, nothing happens.
- Parameters:
category – The category to hide.
- categoryVisible(category: pyqtribbon.category.RibbonCategory) bool [source]
Return whether the category is shown.
- Parameters:
category – The category to check.
- Returns:
Whether the category is shown.
- removeCategory(category: pyqtribbon.category.RibbonCategory)[source]
Remove a category from the ribbon.
- Parameters:
category – The category to remove.
- removeCategories(categories: pyqtribbon.category.RibbonContextCategories)[source]
Remove a list of categories from the ribbon.
- Parameters:
categories – The categories to remove.
- setCurrentCategory(category: pyqtribbon.category.RibbonCategory)[source]
Set the current category.
- Parameters:
category – The category to set.
- currentCategory() pyqtribbon.category.RibbonCategory [source]
Return the current category.
- Returns:
The current category.
- minimumSizeHint() qtpy.QtCore.QSize [source]
Return the minimum size hint of the widget.
- Returns:
The minimum size hint.
pyqtribbon.screenshotwindow
Module Contents
Classes
This class is just for taking a screenshot of the window, the window will be closed 0.1s after it is shown. |
- class pyqtribbon.screenshotwindow.RibbonScreenShotWindow(fileName: str = 'shot.jpg', *args, **kwargs)[source]
Bases:
qtpy.QtWidgets.QMainWindow
This class is just for taking a screenshot of the window, the window will be closed 0.1s after it is shown.
pyqtribbon.separator
Module Contents
Classes
The RibbonSeparator is a separator that can be used to separate widgets in a ribbon. |
|
Horizontal separator. |
|
Vertical separator. |
- class pyqtribbon.separator.RibbonSeparator(orientation=QtCore.Qt.Vertical, width=6, parent=None) RibbonSeparator(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
The RibbonSeparator is a separator that can be used to separate widgets in a ribbon.
- class pyqtribbon.separator.RibbonHorizontalSeparator(width: int = 6, parent=None)[source]
Bases:
RibbonSeparator
Horizontal separator.
- class pyqtribbon.separator.RibbonVerticalSeparator(width: int = 6, parent=None)[source]
Bases:
RibbonSeparator
Vertical separator.
pyqtribbon.tabbar
Module Contents
Classes
The TabBar for the title widget. |
- class pyqtribbon.tabbar.RibbonTabBar(parent=None)[source]
Bases:
qtpy.QtWidgets.QTabBar
The TabBar for the title widget.
- 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.
- addTab(text: str, color: qtpy.QtGui.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.
- addAssociatedTabs(name: str, texts: List[str], color: qtpy.QtGui.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.
pyqtribbon.titlewidget
Module Contents
Classes
Application button in the ribbon bar. |
|
Title label in the ribbon bar. |
|
The title widget of the ribbon. |
- class pyqtribbon.titlewidget.RibbonApplicationButton[source]
Bases:
qtpy.QtWidgets.QToolButton
Application button in the ribbon bar.
- addFileMenu() pyqtribbon.menu.RibbonMenu [source]
Add a new ribbon menu to the application button.
- Returns:
The new ribbon menu.
- class pyqtribbon.titlewidget.RibbonTitleLabel[source]
Bases:
qtpy.QtWidgets.QLabel
Title label in the ribbon bar.
- class pyqtribbon.titlewidget.RibbonTitleWidget(title='PyQtRibbon', parent=None) RibbonTitleWidget(parent=None)[source]
Bases:
qtpy.QtWidgets.QFrame
The title widget of the ribbon.
- applicationButton() RibbonApplicationButton [source]
Return the application button.
- setApplicationIcon(icon: qtpy.QtGui.QIcon)[source]
Set the application icon.
- Parameters:
icon – The icon to set.
- addTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the title layout.
- Parameters:
widget – The widget to add.
- insertTitleWidget(index: int, widget: qtpy.QtWidgets.QWidget)[source]
Insert a widget to the title layout.
- Parameters:
index – The index to insert the widget.
widget – The widget to insert.
- removeTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Remove a widget from the title layout.
- Parameters:
widget – The widget to remove.
- tabBar() pyqtribbon.tabbar.RibbonTabBar [source]
Return the tab bar of the ribbon.
- Returns:
The tab bar of the ribbon.
- quickAccessToolBar() qtpy.QtWidgets.QToolBar [source]
Return the quick access toolbar of the ribbon.
- Returns:
The quick access toolbar of the ribbon.
- quickAccessButtons() List[qtpy.QtWidgets.QToolButton] [source]
Return the quick access buttons of the ribbon.
- Returns:
The quick access buttons of the ribbon.
- addQuickAccessButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a widget to the quick access bar.
- Parameters:
button – The button to add.
- setQuickAccessButtonHeight(height: int = 30)[source]
Set the height of the quick access buttons.
- Parameters:
height – The height to set.
- rightToolBar() qtpy.QtWidgets.QToolBar [source]
Return the right toolbar of the ribbon.
- Returns:
The right toolbar of the ribbon.
- addRightToolButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a widget to the right button bar.
- Parameters:
button – The button to add.
- setRightToolBarHeight(height: int = 24)[source]
Set the height of the right buttons.
- Parameters:
height – The height to set.
- helpRibbonButton() qtpy.QtWidgets.QToolButton [source]
Return the help ribbon button.
- Returns:
The help ribbon button.
- setHelpButtonIcon(icon: qtpy.QtGui.QIcon)[source]
Set the icon of the help button.
- Parameters:
icon – The icon to set.
pyqtribbon.typehints
Module Contents
Classes
This is a protocol for the pyqt signal type. |
|
This is a protocol for the pyqt action type. |
|
This is a protocol for the ribbon type for type hints in categories for getting the tabRect. |
- class pyqtribbon.typehints.PyQtActionType[source]
This is a protocol for the pyqt action type.
- triggered: PyQtSignalType[source]
pyqtribbon.utils
Module Contents
Functions
|
Return the path to a data file. |
Package Contents
Classes
The button style of a category. |
|
A permanent menu. |
|
Mode to find available space in a grid layout, ColumnWise or RowWise. |
|
The RibbonBar class is the top level widget that contains the ribbon. |
|
Enum where members are also (and must be) ints |
|
Button style, Small, Medium, or Large. |
Attributes
- class pyqtribbon.RibbonCategoryStyle[source]
Bases:
enum.IntEnum
The button style of a category.
- class pyqtribbon.RibbonMenu(title: str = '', parent=None) RibbonMenu(parent=None)[source]
Bases:
qtpy.QtWidgets.QMenu
- addWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the menu.
- Parameters:
widget – The widget to add.
- addHorizontalLayoutWidget() qtpy.QtWidgets.QHBoxLayout [source]
Add a horizontal layout widget to the menu.
- Returns:
The horizontal layout.
- addVerticalLayoutWidget() qtpy.QtWidgets.QVBoxLayout [source]
Add a vertical layout widget to the menu.
- Returns:
The vertical layout.
- addGridLayoutWidget() qtpy.QtWidgets.QGridLayout [source]
Add a grid layout widget to the menu.
- Returns:
The grid layout.
- class pyqtribbon.RibbonPermanentMenu(title: str = '', parent=None) RibbonPermanentMenu(parent=None)[source]
Bases:
RibbonMenu
A permanent menu.
- hideEvent(a0: QHideEvent) None [source]
- actionEvent(a0: QActionEvent) None [source]
- class pyqtribbon.RibbonSpaceFindMode[source]
Bases:
enum.IntEnum
Mode to find available space in a grid layout, ColumnWise or RowWise.
- class pyqtribbon.RibbonBar(title: str = '', maxRows=6, parent=None) RibbonBar(parent=None)[source]
Bases:
qtpy.QtWidgets.QMenuBar
The RibbonBar class is the top level widget that contains the ribbon.
- _categories: Dict[str, pyqtribbon.category.RibbonCategory][source]
- setRibbonStyle(style: RibbonStyle)[source]
Set the style of the ribbon.
- Parameters:
style – The style to set.
- applicationOptionButton() pyqtribbon.titlewidget.RibbonApplicationButton [source]
Return the application button.
- setApplicationIcon(icon: qtpy.QtGui.QIcon)[source]
Set the application icon.
- Parameters:
icon – The icon to set.
- addTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Add a widget to the title widget.
- Parameters:
widget – The widget to add.
- removeTitleWidget(widget: qtpy.QtWidgets.QWidget)[source]
Remove a widget from the title widget.
- Parameters:
widget – The widget to remove.
- insertTitleWidget(index: int, widget: qtpy.QtWidgets.QWidget)[source]
Insert a widget to the title widget.
- Parameters:
index – The index to insert the widget.
widget – The widget to insert.
- addFileMenu() pyqtribbon.menu.RibbonMenu [source]
Add a file menu to the ribbon.
- setRibbonHeight(height: int)[source]
Set the total height of the ribbon.
- Parameters:
height – The height to set.
- tabBar() pyqtribbon.tabbar.RibbonTabBar [source]
Return the tab bar of the ribbon.
- Returns:
The tab bar of the ribbon.
- quickAccessToolBar() qtpy.QtWidgets.QToolBar [source]
Return the quick access toolbar of the ribbon.
- Returns:
The quick access toolbar of the ribbon.
- addQuickAccessButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a button to the quick access bar.
- Parameters:
button – The button to add.
- setQuickAccessButtonHeight(height: int = 30)[source]
Set the height of the quick access buttons.
- Parameters:
height – The height to set.
- rightToolBar() qtpy.QtWidgets.QToolBar [source]
Return the right toolbar of the ribbon.
- Returns:
The right toolbar of the ribbon.
- addRightToolButton(button: qtpy.QtWidgets.QToolButton)[source]
Add a widget to the right button bar.
- Parameters:
button – The button to add.
- setRightToolBarHeight(height: int = 24)[source]
Set the height of the right buttons.
- Parameters:
height – The height to set.
- helpRibbonButton() qtpy.QtWidgets.QToolButton [source]
Return the help button of the ribbon.
- Returns:
The help button of the ribbon.
- setHelpButtonIcon(icon: qtpy.QtGui.QIcon)[source]
Set the icon of the help button.
- Parameters:
icon – The icon to set.
- collapseRibbonButton() qtpy.QtWidgets.QToolButton [source]
Return the collapse ribbon button.
- Returns:
The collapse ribbon button.
- setCollapseButtonIcon(icon: qtpy.QtGui.QIcon)[source]
Set the icon of the min button.
- Parameters:
icon – The icon to set.
- category(name: str) pyqtribbon.category.RibbonCategory [source]
Return the category with the given name.
- Parameters:
name – The name of the category.
- Returns:
The category with the given name.
- categories() Dict[str, pyqtribbon.category.RibbonCategory] [source]
Return a list of categories of the ribbon.
- Returns:
A dict of categories of the ribbon.
- addCategoriesBy(data: Dict[str, Dict]) Dict[str, pyqtribbon.category.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: qtpy.QtGui.QColor = None) pyqtribbon.category.RibbonNormalCategory | pyqtribbon.category.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.
- addNormalCategory(title: str) pyqtribbon.category.RibbonNormalCategory [source]
Add a new category to the ribbon.
- Parameters:
title – The title of the category.
- Returns:
The newly created category.
- addContextCategory(title: str, color: qtpy.QtGui.QColor | qtpy.QtCore.Qt.GlobalColor = QtCore.Qt.blue) pyqtribbon.category.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.
- addContextCategories(name: str, titles: List[str], color: qtpy.QtGui.QColor | qtpy.QtCore.Qt.GlobalColor = QtCore.Qt.blue) pyqtribbon.category.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.
- showContextCategory(category: pyqtribbon.category.RibbonContextCategory | pyqtribbon.category.RibbonContextCategories)[source]
Show the given category or categories, if it is not a context category, nothing happens.
- Parameters:
category – The category to show.
- hideContextCategory(category: pyqtribbon.category.RibbonContextCategory | pyqtribbon.category.RibbonContextCategories)[source]
Hide the given category or categories, if it is not a context category, nothing happens.
- Parameters:
category – The category to hide.
- categoryVisible(category: pyqtribbon.category.RibbonCategory) bool [source]
Return whether the category is shown.
- Parameters:
category – The category to check.
- Returns:
Whether the category is shown.
- removeCategory(category: pyqtribbon.category.RibbonCategory)[source]
Remove a category from the ribbon.
- Parameters:
category – The category to remove.
- removeCategories(categories: pyqtribbon.category.RibbonContextCategories)[source]
Remove a list of categories from the ribbon.
- Parameters:
categories – The categories to remove.
- setCurrentCategory(category: pyqtribbon.category.RibbonCategory)[source]
Set the current category.
- Parameters:
category – The category to set.
- currentCategory() pyqtribbon.category.RibbonCategory [source]
Return the current category.
- Returns:
The current category.
- minimumSizeHint() qtpy.QtCore.QSize [source]
Return the minimum size hint of the widget.
- Returns:
The minimum size hint.
- class pyqtribbon.RibbonStyle[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- class pyqtribbon.RibbonButtonStyle[source]
Bases:
enum.IntEnum
Button style, Small, Medium, or Large.