I'm trying to write a python script using PyQt. I want to grab from a sqlite db some info and then display it in checkboxes inside a scroll-area in case the list gets too big:
def addCheckBox(self):
cbCurrentTxt = str(self.comboBox.currentText())
db = sqlite3.connect("data.db")
x = 10
for checkBoxPop in db.execute("SELECT * FROM users WHERE week='"+cbCurrentTxt+"';"):
print checkBoxPop
self.checkBox = QtGui.QCheckBox(self.scrollArea)
self.checkBox.setGeometry(QtCore.QRect(10, x, 95, 25))
self.checkBox.setText(_translate("MainwiNdow", str(checkBoxPop[1]), None))
self.checkBox_2 = QtGui.QCheckBox(self.scrollArea)
self.checkBox_2.setGeometry(QtCore.QRect(120, x, 95, 25))
self.checkBox_2.setText(_translate("MainwiNdow", str(checkBoxPop[3]), None))
for i in checkBoxPop[1]:
print "coord" + str(x)
x += 4
I'm using a combobox to get the week:
def populateWeekCB(self):
db = sqlite3.connect("data.db")
cursor = db.cursor()
self.comboBox.clear()
for cbItemsDB in db.execute("select * from week"):
print cbItemsDB
self.comboBox.addItem(cbItemsDB[0])
self.comboBox.activated[str].connect(self.addCheckBox)
After the week gets selected, I want to display the checkboxes, but they aren't showing.