Export QTableWidget
s Data populated by the user to the db file. (the db file doesn't exist so SQLITE3 will create it` in the cited Directory.)
Here's the code I used :
self.CreateDatasetButton.connect(self.createDS)
def CreateDS(self):
self.proceed = QtWidgets.QMessageBox.question(
self,
'Information',
'Have you Verified your Data?',
QtWidgets.QMessageBox.Yes|QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No)
if self.proceed == QtWidgets.QMessageBox.Yes:
self.showDialog()
else:
pass
def showDialog(self):
self.text, ok = QtWidgets.QInputDialog.getText(self, 'Almost Done !',
'
name your file :')
if ok:
self.Createdb()
def Createdb(self):
conn = sqlite3.connect('__Datasets__/%s.db' %(self.text))
# problema here
conn.close()
self.app_statusbar.showMessage('%s is created' %(self.text()))
See Question&Answers more detail:os