Skip to content

Making a Dropdown List of Selectable Subjects #191

Discussion options

You must be logged in to vote

so you want to

  • populate a list with possible subjects
  • select some subset of them
  • trigger some action based on the selected values

Typically the UI element you would use for multiple-selection from a list is a list of checkboxes, see an example here: https://github.com/pyside/pyside2-examples/blob/696f0677ea3c982344364f633845ed39b686cdb3/examples/widgets/widgets/groupbox.py

So you'd populate a layout with pairs of (QCheckBox, QLabel)s that let you check individual subjects, and then read the checked values when you want to use them. So a quick example.

from PySide2 import QtWidgets
from PySide2.QtWidgets import QCheckBox, QPushButton, QLabel, QGroupBox
from typing import List, Dict, Tuple, 

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@jmdelahanty
Comment options

@jmdelahanty
Comment options

Answer selected by jmdelahanty
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants