I am very new to PyQt, so I am not even sure where to start searching for this.
So I have two different options for QRadioButtons which ideally will correspond to two QPushButtons, one each.
Basically, I have the following code, where i tried to achieve this by using if statements:
def tab1UI(self):
mytabfont = QFont('Lucida Sans Unicode', 9)
layout = QFormLayout()
#self.setTabText(0,"My Data")
self.tab1.setLayout(layout)
tabdescription = 'To obtain or generate data choose an option below:'
# radio options
label1 = QLabel(tabdescription)
label1.setFont(mytabfont)
layout.addWidget(label1)
radiobtn1 = QRadioButton('Load data from file')
radiobtn1.setChecked(True)
#why does my resize not work?
radiobtn1.resize(100,100)
radiobtn1.setFont(mytabfont)
layout.addWidget(radiobtn1)
loadbtn = QPushButton('Open CSV file...')
layout.addWidget(loadbtn)
radiobtn2 = QRadioButton('Generate data')
radiobtn2.setFont(mytabfont)
genbtn= QPushButton('Generating matrix...')
layout.addWidget(radiobtn2)
layout.addWidget(genbtn)
if radiobtn1.isChecked():
# if this option is clicked then this button needs to be activated else it must be de-activated
loadbtn.setEnabled(True)
genbtn.setEnabled(False)
elif radiobtn2.isChecked():
loadbtn.setEnabled(False)
genbtn.setEnabled(True)
else:
loadbtn.setEnabled(False)
genbtn.setEnabled(False)
So, whenever I click one radio-button option I would like one pushbutton to become automatically active or inactive when the other option is checked instead. There must be some sort of Action to be connected but not sure how to go about this.