Socket
Socket
Sign inDemoInstall

pyqt6-multiselect-combobox

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pyqt6-multiselect-combobox

A custom PyQt6 widget providing a multi-select combobox functionality for PyQt6 applications.


Maintainers
1

Readme

MultiSelectComboBox

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.

Purpose

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.

Features

  • Multiple Selection: Users can select multiple items from the dropdown list.
  • Customizable Display: The widget allows customization of the display format for both the selected items and the dropdown items.
  • Output Control: Users can control whether the output should be in the form of data or text.
  • Display Delimiter: Users can specify a custom delimiter to separate the displayed items.
  • Resizable: The widget dynamically adjusts its size to accommodate the selected items.
  • User-friendly Interface: The interface is designed to be intuitive, allowing users to easily select and deselect items.

See all features in documentation.

How to Use

To use the MultiSelectComboBox widget in your PyQt6 application, follow these steps:

  1. Installation: Install the package using pip:

    pip install pyqt6-multiselect-combobox
    
  2. Import: Import the MultiSelectComboBox class into your Python code:

    from pyqt6_multiselect_combobox import MultiSelectComboBox
    
  3. Initialization: Create an instance of MultiSelectComboBox:

    multi_select_combo_box = MultiSelectComboBox()
    
  4. 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"])
    
  5. 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(", ")
    
  6. Event Handling: Handle events such as item selection and deselection if required.

  7. Accessing Selected Data: Retrieve the selected data using the currentData() method:

    selected_data = multi_select_combo_box.currentData()
    

Example

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

Additional Notes

  • Compatibility: MultiSelectComboBox is compatible with PyQt6.
  • Feedback and Contributions: Feedback and contributions are welcome. Feel free to open an issue or submit a pull request on GitHub.
  • License: This package is provided under the MIT License.

For more detailed usage and customization options, refer to the documentation.

FAQs


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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc