Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
pyqt6-multiselect-combobox
A custom PyQt6 widget providing a multi-select combobox functionality for PyQt6 applications.
Readme
MultiSelectComboBox is a custom widget built using PyQt6 that provides a dropdown combo box allowing users to select multiple items. This widget is particularly useful in scenarios where users need to select multiple options from a list.
The primary purpose of MultiSelectComboBox is to offer a user-friendly interface for selecting multiple items from a list efficiently. It allows users to choose from a set of options and displays the selected items in a compact manner.
See all features in documentation.
To use the MultiSelectComboBox widget in your PyQt6 application, follow these steps:
Installation: Install the package using pip:
pip install pyqt6-multiselect-combobox
Import: Import the MultiSelectComboBox class into your Python code:
from pyqt6_multiselect_combobox import MultiSelectComboBox
Initialization: Create an instance of MultiSelectComboBox:
multi_select_combo_box = MultiSelectComboBox()
Adding Items: Add items to the dropdown list using addItem()
or addItems()
methods:
multi_select_combo_box.addItem("Item 1", "Data 1")
multi_select_combo_box.addItem("Item 2", "Data 2")
multi_select_combo_box.addItems(["Item 3", "Item 4"], ["Data 3", "Data 4"])
Customization: Customize the display format, output type, and display delimiter as needed:
multi_select_combo_box.setDisplayType("text")
multi_select_combo_box.setOutputType("data")
multi_select_combo_box.setDisplayDelimiter(", ")
Event Handling: Handle events such as item selection and deselection if required.
Accessing Selected Data: Retrieve the selected data using the currentData()
method:
selected_data = multi_select_combo_box.currentData()
from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from pyqt6_multiselect_combobox import MultiSelectComboBox
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("MultiSelectComboBox Example")
central_widget = QWidget()
layout = QVBoxLayout()
central_widget.setLayout(layout)
multi_select_combo_box = MultiSelectComboBox()
multi_select_combo_box.addItems(["Apple", "Banana", "Orange"])
layout.addWidget(multi_select_combo_box)
self.setCentralWidget(central_widget)
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.show()
app.exec()
For more detailed usage and customization options, refer to the documentation.
FAQs
A custom PyQt6 widget providing a multi-select combobox functionality for PyQt6 applications.
We found that pyqt6-multiselect-combobox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.