I'm trying to condense the vertical spacing between a group of radio buttons in PyQT and am struggling. I would like the 3 options in the picture to be vertically closer together...
Code for reproducing:
class MyPopUp(QWidget):
def __init__(self, task=None):
super(MyPopUp, self).__init__()
self.task = task
self.setMinimumSize(400,600)
self.populate_fields()
def populate_fields(self):
self.task_popup_layout = QVBoxLayout()
self.setLayout(self.task_popup_layout)
# When do you need to get it done by
self.scheduling_header_label = QLabel("<h3>Getting it done</h3>")
self.task_popup_layout.addWidget(self.scheduling_header_label)
# Deadline date
self.deadline_layout = QHBoxLayout()
self.deadline_date_label = QLabel("When does it need to be complete by?")
self.deadline_layout.addWidget(self.deadline_date_label)
self.deadline_dateedit = QDateEdit(calendarPopup=True)
self.deadline_dateedit.setAlignment(Qt.AlignmentFlag.AlignRight)
self.deadline_dateedit.setDateTime(datetime.now() + timedelta(days=7))
self.deadline_layout.addWidget(self.deadline_dateedit)
self.task_popup_layout.addLayout(self.deadline_layout)
# Type of deadline
self.deadline_type_layout = QHBoxLayout()
self.task_popup_layout.addLayout(self.deadline_type_layout)
self.deadline_type_label = QLabel("How strict is the deadline")
self.deadline_type_label.setWordWrap(True)
self.deadline_type_layout.addWidget(self.deadline_type_label)
self.deadline_group_layout = QVBoxLayout()
self.deadline_type_layout.addLayout(self.deadline_group_layout)
self.deadline_group = QButtonGroup()
self.soft_deadline_radio = QRadioButton("Target Deadline")
self.deadline_group_layout.addWidget(self.soft_deadline_radio)
self.deadline_group.addButton(self.soft_deadline_radio)
self.hard_deadline_radio = QRadioButton("Hard Deadline")
self.hard_deadline_radio.setChecked(True)
self.deadline_group_layout.addWidget(self.hard_deadline_radio)
self.deadline_group.addButton(self.hard_deadline_radio)
self.specific_deadline_radio = QRadioButton("Must be done on this exact day")
self.deadline_group_layout.addWidget(self.specific_deadline_radio)
self.deadline_group.addButton(self.specific_deadline_radio)
