Python Sqlite3-Program Breaking After Calling execute- SELECT QueryWhat does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Python Sqlite3 Update query not workingPyQt5 using SQLite3, on button press doing a queryPython and SQLite3 SELECT statementSelecting data in an Sqlite3 database-PythonProgram quits while executing pushbutton in PyQT/QtDesigner programPython - Sqlite3 - Select query with database double dot operatormultiple gui python qt and switch between themIn Sqlite3 SELECT statement does not return all possible rowsHow to open again a database after being closed and deleted on SQLITE3
Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?
God-Pharaoh's Statue and Finale Of Promise
Which creature is depicted in this Xanathar's Guide illustration of a war mage?
Does addError() work outside of triggers?
Cuban Primes
How to handle professionally if colleagues has referred his relative and asking to take easy while taking interview
What do you call the hair or body hair you trim off your body?
Could a space colony 1g from the sun work?
Why doesn't Iron Man's action affect this person in Endgame?
Does it matter what way the tires go if no directional arrow?
Holding rent money for my friend which amounts to over $10k?
Why can't I share a one use code with anyone else?
What dog breeds survive the apocalypse for generations?
Given 0s on Assignments with suspected and dismissed cheating?
Testing blind license applicants
With today's technology, could iron be smelted at La Rinconada?
labelled end points on logic diagram
Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?
Why is Drogon so much better in battle than Rhaegal and Viserion?
What do the "optional" resistor and capacitor do in this circuit?
Polynomial division: Is this trick obvious?
tikz drawing rectangle discretized with triangle lattices and its centroids
Would life always name the light from their sun "white"
How does a permutation act on a string?
Python Sqlite3-Program Breaking After Calling execute- SELECT Query
What does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Python Sqlite3 Update query not workingPyQt5 using SQLite3, on button press doing a queryPython and SQLite3 SELECT statementSelecting data in an Sqlite3 database-PythonProgram quits while executing pushbutton in PyQT/QtDesigner programPython - Sqlite3 - Select query with database double dot operatormultiple gui python qt and switch between themIn Sqlite3 SELECT statement does not return all possible rowsHow to open again a database after being closed and deleted on SQLITE3
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Select query is not executing in python3-sqlite3, instead my program breaks right after that statement. My code is running fine with no errors but whenever i click on radio button (in GUI) which calls a function containing above execute statement ,it breaks.
I'm new to sqlite3 and even python3, I'm working on my first python project which is built using above 2 and Qt designer, after converting my code from qtdesigner i added necessary codes, here's MyCricket.py code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QPushButton, QRadioButton, QFrame, QMessageBox)
from DialogBox2 import Ui_Dialog
from PyQt5.QtCore import pyqtSlot, QRect
class Ui_MainWindow(object):
def setupUi(self,MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(730, 562)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(20, 30, 101, 21))
font = QtGui.QFont()
font.setPointSize(9)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 60, 681, 61))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout.addWidget(self.label_8)
self.l1 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l1.setFont(font)
self.l1.setObjectName("l1")
self.horizontalLayout.addWidget(self.l1)
self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.horizontalLayout.addWidget(self.label_9)
self.l2 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l2.setFont(font)
self.l2.setObjectName("l2")
self.horizontalLayout.addWidget(self.l2)
self.label_5 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.l3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l3.setFont(font)
self.l3.setObjectName("l3")
self.horizontalLayout.addWidget(self.l3)
self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.horizontalLayout.addWidget(self.label_3)
self.l4 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l4.setFont(font)
self.l4.setObjectName("l4")
self.horizontalLayout.addWidget(self.l4)
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 130, 681, 51))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_13 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_13.setFont(font)
self.label_13.setObjectName("label_13")
self.horizontalLayout_2.addWidget(self.label_13)
self.l5 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l5.setFont(font)
self.l5.setObjectName("l5")
self.horizontalLayout_2.addWidget(self.l5)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_11.setFont(font)
self.label_11.setObjectName("label_11")
self.horizontalLayout_2.addWidget(self.label_11)
self.l6 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l6.setFont(font)
self.l6.setObjectName("l6")
self.horizontalLayout_2.addWidget(self.l6)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.listW1 = QtWidgets.QListWidget(self.centralwidget)
self.listW1.setGeometry(QtCore.QRect(30, 230, 261, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW1.setFont(font)
self.listW1.setObjectName("listW1")
item = QtWidgets.QListWidgetItem()
self.listW2 = QtWidgets.QListWidget(self.centralwidget)
self.listW2.setGeometry(QtCore.QRect(350, 230, 281, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW2.setFont(font)
self.listW2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.listW2.setObjectName("listW2")
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(30, 190, 261, 51))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.rb1 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb1.setObjectName("rb1")
self.horizontalLayout_3.addWidget(self.rb1)
self.rb2 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb2.setObjectName("rb2")
self.horizontalLayout_3.addWidget(self.rb2)
self.rb3 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb3.setObjectName("rb3")
self.horizontalLayout_3.addWidget(self.rb3)
self.rb4 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb4.setObjectName("rb4")
self.horizontalLayout_3.addWidget(self.rb4)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(350, 190, 281, 51))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem2)
self.label_14 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_14.setFont(font)
self.label_14.setObjectName("label_14")
self.horizontalLayout_4.addWidget(self.label_14)
self.l7 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
self.l7.setObjectName("l7")
self.horizontalLayout_4.addWidget(self.l7)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem3)
self.label_16 = QtWidgets.QLabel(self.centralwidget)
self.label_16.setGeometry(QtCore.QRect(310, 320, 21, 41))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(False)
font.setWeight(50)
self.label_16.setFont(font)
self.label_16.setObjectName("label_16")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 730, 21))
self.menubar.setObjectName("menubar")
self.menuManage_Teams = QtWidgets.QMenu(self.menubar)
self.menuManage_Teams.setObjectName("menuManage_Teams")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionNEW_Team = QtWidgets.QAction(MainWindow)
self.actionNEW_Team.setObjectName("actionNEW_Team")
self.actionOPEN_Team = QtWidgets.QAction(MainWindow)
self.actionOPEN_Team.setObjectName("actionOPEN_Team")
self.actionSAVE_Team = QtWidgets.QAction(MainWindow)
self.actionSAVE_Team.setObjectName("actionSAVE_Team")
self.actionEVALUATE_Team = QtWidgets.QAction(MainWindow)
self.actionEVALUATE_Team.setObjectName("actionEVALUATE_Team")
#self.actionEVALUATE_Team.triggered.connect(self.OpenWindow)
self.menuManage_Teams.addAction(self.actionNEW_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionOPEN_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionSAVE_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionEVALUATE_Team)
self.menubar.addAction(self.menuManage_Teams.menuAction())
#self.listW1.itemDoubleClicked.connect(self.removelist1)
#self.listW2.itemDoubleClicked.connect(self.removelist2)
self.rb1.clicked.connect(self.fillList)
self.rb2.clicked.connect(self.fillList)
self.rb3.clicked.connect(self.fillList)
self.rb4.clicked.connect(self.fillList)
#self.menuManage_Teams.triggered[QtWidgets.QAction].connect(self.menu)
self.bat=0
self.bwl=0
self.ar=0
self.wk=0
self.avl=1000
self.used=0
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Fantasy Cricket Game"))
self.label.setText(_translate("MainWindow", "Your Selections"))
self.label_8.setText(_translate("MainWindow", "Batsmen(BAT)"))
self.l1.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "Bowlers(BOW)"))
self.l2.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_5.setText(_translate("MainWindow", "Allrounders(AR)"))
self.l3.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_3.setText(_translate("MainWindow", "Wicket-keeper(WK)"))
self.l4.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_13.setText(_translate("MainWindow", "Points Available"))
self.l5.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.label_11.setText(_translate("MainWindow", "Points Used"))
self.l6.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.rb1.setText(_translate("MainWindow", "BAT"))
self.rb2.setText(_translate("MainWindow", "BOW"))
self.rb3.setText(_translate("MainWindow", "AR"))
self.rb4.setText(_translate("MainWindow", "WK"))
self.label_14.setText(_translate("MainWindow", "Team Name"))
self.l7.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">Displayed Here</span></p></body></html>"))
self.label_16.setText(_translate("MainWindow", ">"))
self.menuManage_Teams.setTitle(_translate("MainWindow", "Manage Teams"))
self.actionNEW_Team.setText(_translate("MainWindow", "NEW Team"))
self.actionOPEN_Team.setText(_translate("MainWindow", "OPEN Team"))
self.actionSAVE_Team.setText(_translate("MainWindow", "SAVE Team"))
self.actionEVALUATE_Team.setText(_translate("MainWindow", "EVALUATE Team"))
def fillList(self):
curcricket = MyCricket.cursor()
if self.rb1.isChecked(): # Only showing for radiobutton1 code for rest buttons are similar.
print("HELP")
curcricket.execute("SELECT * FROM Stats WHERE Ctg = BAT;") # This is breaking my code, i added 2 print 'help' to check this breaking.
print("HELP")
BT = curcricket.fetchall()
self.listW1.clear()
for i in range(len(BT)):
item1 = QtWidgets.QListWidgetItem(BT[i][0])
font = QtGui.QFont()
font.setFamily("Comic Sans MS")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
item1.setFont(font)
self.listW1.addItem(item1)
curcricket.close()
if __name__ == "__main__":
import sqlite3
MyCricket=sqlite3.connect('MyCricket.db')
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
My application contains Qradiobuttons(BAT,BWL,AR,WK) and QlistWidgets
Whenever radio buttons are clicked i want my list widget to be filled with my Stats Table (only column 1 i.e "Player"(player-name) of particular Category column 7 i.e "Ctg" (BAT,BWL..) ) of database MyCricket.db. Im stuck with this problem and im not able to proceed futher. I wasted a lot of time searching over internet but didnt find a soln to this,I'm still researching so if anyone has the answer, please let me know.
python-3.x sqlite pyqt pyqt5 qt-designer
|
show 2 more comments
Select query is not executing in python3-sqlite3, instead my program breaks right after that statement. My code is running fine with no errors but whenever i click on radio button (in GUI) which calls a function containing above execute statement ,it breaks.
I'm new to sqlite3 and even python3, I'm working on my first python project which is built using above 2 and Qt designer, after converting my code from qtdesigner i added necessary codes, here's MyCricket.py code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QPushButton, QRadioButton, QFrame, QMessageBox)
from DialogBox2 import Ui_Dialog
from PyQt5.QtCore import pyqtSlot, QRect
class Ui_MainWindow(object):
def setupUi(self,MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(730, 562)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(20, 30, 101, 21))
font = QtGui.QFont()
font.setPointSize(9)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 60, 681, 61))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout.addWidget(self.label_8)
self.l1 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l1.setFont(font)
self.l1.setObjectName("l1")
self.horizontalLayout.addWidget(self.l1)
self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.horizontalLayout.addWidget(self.label_9)
self.l2 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l2.setFont(font)
self.l2.setObjectName("l2")
self.horizontalLayout.addWidget(self.l2)
self.label_5 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.l3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l3.setFont(font)
self.l3.setObjectName("l3")
self.horizontalLayout.addWidget(self.l3)
self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.horizontalLayout.addWidget(self.label_3)
self.l4 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l4.setFont(font)
self.l4.setObjectName("l4")
self.horizontalLayout.addWidget(self.l4)
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 130, 681, 51))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_13 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_13.setFont(font)
self.label_13.setObjectName("label_13")
self.horizontalLayout_2.addWidget(self.label_13)
self.l5 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l5.setFont(font)
self.l5.setObjectName("l5")
self.horizontalLayout_2.addWidget(self.l5)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_11.setFont(font)
self.label_11.setObjectName("label_11")
self.horizontalLayout_2.addWidget(self.label_11)
self.l6 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l6.setFont(font)
self.l6.setObjectName("l6")
self.horizontalLayout_2.addWidget(self.l6)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.listW1 = QtWidgets.QListWidget(self.centralwidget)
self.listW1.setGeometry(QtCore.QRect(30, 230, 261, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW1.setFont(font)
self.listW1.setObjectName("listW1")
item = QtWidgets.QListWidgetItem()
self.listW2 = QtWidgets.QListWidget(self.centralwidget)
self.listW2.setGeometry(QtCore.QRect(350, 230, 281, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW2.setFont(font)
self.listW2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.listW2.setObjectName("listW2")
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(30, 190, 261, 51))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.rb1 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb1.setObjectName("rb1")
self.horizontalLayout_3.addWidget(self.rb1)
self.rb2 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb2.setObjectName("rb2")
self.horizontalLayout_3.addWidget(self.rb2)
self.rb3 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb3.setObjectName("rb3")
self.horizontalLayout_3.addWidget(self.rb3)
self.rb4 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb4.setObjectName("rb4")
self.horizontalLayout_3.addWidget(self.rb4)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(350, 190, 281, 51))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem2)
self.label_14 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_14.setFont(font)
self.label_14.setObjectName("label_14")
self.horizontalLayout_4.addWidget(self.label_14)
self.l7 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
self.l7.setObjectName("l7")
self.horizontalLayout_4.addWidget(self.l7)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem3)
self.label_16 = QtWidgets.QLabel(self.centralwidget)
self.label_16.setGeometry(QtCore.QRect(310, 320, 21, 41))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(False)
font.setWeight(50)
self.label_16.setFont(font)
self.label_16.setObjectName("label_16")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 730, 21))
self.menubar.setObjectName("menubar")
self.menuManage_Teams = QtWidgets.QMenu(self.menubar)
self.menuManage_Teams.setObjectName("menuManage_Teams")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionNEW_Team = QtWidgets.QAction(MainWindow)
self.actionNEW_Team.setObjectName("actionNEW_Team")
self.actionOPEN_Team = QtWidgets.QAction(MainWindow)
self.actionOPEN_Team.setObjectName("actionOPEN_Team")
self.actionSAVE_Team = QtWidgets.QAction(MainWindow)
self.actionSAVE_Team.setObjectName("actionSAVE_Team")
self.actionEVALUATE_Team = QtWidgets.QAction(MainWindow)
self.actionEVALUATE_Team.setObjectName("actionEVALUATE_Team")
#self.actionEVALUATE_Team.triggered.connect(self.OpenWindow)
self.menuManage_Teams.addAction(self.actionNEW_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionOPEN_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionSAVE_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionEVALUATE_Team)
self.menubar.addAction(self.menuManage_Teams.menuAction())
#self.listW1.itemDoubleClicked.connect(self.removelist1)
#self.listW2.itemDoubleClicked.connect(self.removelist2)
self.rb1.clicked.connect(self.fillList)
self.rb2.clicked.connect(self.fillList)
self.rb3.clicked.connect(self.fillList)
self.rb4.clicked.connect(self.fillList)
#self.menuManage_Teams.triggered[QtWidgets.QAction].connect(self.menu)
self.bat=0
self.bwl=0
self.ar=0
self.wk=0
self.avl=1000
self.used=0
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Fantasy Cricket Game"))
self.label.setText(_translate("MainWindow", "Your Selections"))
self.label_8.setText(_translate("MainWindow", "Batsmen(BAT)"))
self.l1.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "Bowlers(BOW)"))
self.l2.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_5.setText(_translate("MainWindow", "Allrounders(AR)"))
self.l3.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_3.setText(_translate("MainWindow", "Wicket-keeper(WK)"))
self.l4.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_13.setText(_translate("MainWindow", "Points Available"))
self.l5.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.label_11.setText(_translate("MainWindow", "Points Used"))
self.l6.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.rb1.setText(_translate("MainWindow", "BAT"))
self.rb2.setText(_translate("MainWindow", "BOW"))
self.rb3.setText(_translate("MainWindow", "AR"))
self.rb4.setText(_translate("MainWindow", "WK"))
self.label_14.setText(_translate("MainWindow", "Team Name"))
self.l7.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">Displayed Here</span></p></body></html>"))
self.label_16.setText(_translate("MainWindow", ">"))
self.menuManage_Teams.setTitle(_translate("MainWindow", "Manage Teams"))
self.actionNEW_Team.setText(_translate("MainWindow", "NEW Team"))
self.actionOPEN_Team.setText(_translate("MainWindow", "OPEN Team"))
self.actionSAVE_Team.setText(_translate("MainWindow", "SAVE Team"))
self.actionEVALUATE_Team.setText(_translate("MainWindow", "EVALUATE Team"))
def fillList(self):
curcricket = MyCricket.cursor()
if self.rb1.isChecked(): # Only showing for radiobutton1 code for rest buttons are similar.
print("HELP")
curcricket.execute("SELECT * FROM Stats WHERE Ctg = BAT;") # This is breaking my code, i added 2 print 'help' to check this breaking.
print("HELP")
BT = curcricket.fetchall()
self.listW1.clear()
for i in range(len(BT)):
item1 = QtWidgets.QListWidgetItem(BT[i][0])
font = QtGui.QFont()
font.setFamily("Comic Sans MS")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
item1.setFont(font)
self.listW1.addItem(item1)
curcricket.close()
if __name__ == "__main__":
import sqlite3
MyCricket=sqlite3.connect('MyCricket.db')
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
My application contains Qradiobuttons(BAT,BWL,AR,WK) and QlistWidgets
Whenever radio buttons are clicked i want my list widget to be filled with my Stats Table (only column 1 i.e "Player"(player-name) of particular Category column 7 i.e "Ctg" (BAT,BWL..) ) of database MyCricket.db. Im stuck with this problem and im not able to proceed futher. I wasted a lot of time searching over internet but didnt find a soln to this,I'm still researching so if anyone has the answer, please let me know.
python-3.x sqlite pyqt pyqt5 qt-designer
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from theMainWindow
class, not fromUi_*
.
– TrebledJ
Mar 23 at 15:36
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25
|
show 2 more comments
Select query is not executing in python3-sqlite3, instead my program breaks right after that statement. My code is running fine with no errors but whenever i click on radio button (in GUI) which calls a function containing above execute statement ,it breaks.
I'm new to sqlite3 and even python3, I'm working on my first python project which is built using above 2 and Qt designer, after converting my code from qtdesigner i added necessary codes, here's MyCricket.py code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QPushButton, QRadioButton, QFrame, QMessageBox)
from DialogBox2 import Ui_Dialog
from PyQt5.QtCore import pyqtSlot, QRect
class Ui_MainWindow(object):
def setupUi(self,MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(730, 562)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(20, 30, 101, 21))
font = QtGui.QFont()
font.setPointSize(9)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 60, 681, 61))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout.addWidget(self.label_8)
self.l1 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l1.setFont(font)
self.l1.setObjectName("l1")
self.horizontalLayout.addWidget(self.l1)
self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.horizontalLayout.addWidget(self.label_9)
self.l2 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l2.setFont(font)
self.l2.setObjectName("l2")
self.horizontalLayout.addWidget(self.l2)
self.label_5 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.l3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l3.setFont(font)
self.l3.setObjectName("l3")
self.horizontalLayout.addWidget(self.l3)
self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.horizontalLayout.addWidget(self.label_3)
self.l4 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l4.setFont(font)
self.l4.setObjectName("l4")
self.horizontalLayout.addWidget(self.l4)
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 130, 681, 51))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_13 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_13.setFont(font)
self.label_13.setObjectName("label_13")
self.horizontalLayout_2.addWidget(self.label_13)
self.l5 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l5.setFont(font)
self.l5.setObjectName("l5")
self.horizontalLayout_2.addWidget(self.l5)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_11.setFont(font)
self.label_11.setObjectName("label_11")
self.horizontalLayout_2.addWidget(self.label_11)
self.l6 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l6.setFont(font)
self.l6.setObjectName("l6")
self.horizontalLayout_2.addWidget(self.l6)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.listW1 = QtWidgets.QListWidget(self.centralwidget)
self.listW1.setGeometry(QtCore.QRect(30, 230, 261, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW1.setFont(font)
self.listW1.setObjectName("listW1")
item = QtWidgets.QListWidgetItem()
self.listW2 = QtWidgets.QListWidget(self.centralwidget)
self.listW2.setGeometry(QtCore.QRect(350, 230, 281, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW2.setFont(font)
self.listW2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.listW2.setObjectName("listW2")
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(30, 190, 261, 51))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.rb1 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb1.setObjectName("rb1")
self.horizontalLayout_3.addWidget(self.rb1)
self.rb2 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb2.setObjectName("rb2")
self.horizontalLayout_3.addWidget(self.rb2)
self.rb3 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb3.setObjectName("rb3")
self.horizontalLayout_3.addWidget(self.rb3)
self.rb4 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb4.setObjectName("rb4")
self.horizontalLayout_3.addWidget(self.rb4)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(350, 190, 281, 51))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem2)
self.label_14 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_14.setFont(font)
self.label_14.setObjectName("label_14")
self.horizontalLayout_4.addWidget(self.label_14)
self.l7 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
self.l7.setObjectName("l7")
self.horizontalLayout_4.addWidget(self.l7)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem3)
self.label_16 = QtWidgets.QLabel(self.centralwidget)
self.label_16.setGeometry(QtCore.QRect(310, 320, 21, 41))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(False)
font.setWeight(50)
self.label_16.setFont(font)
self.label_16.setObjectName("label_16")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 730, 21))
self.menubar.setObjectName("menubar")
self.menuManage_Teams = QtWidgets.QMenu(self.menubar)
self.menuManage_Teams.setObjectName("menuManage_Teams")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionNEW_Team = QtWidgets.QAction(MainWindow)
self.actionNEW_Team.setObjectName("actionNEW_Team")
self.actionOPEN_Team = QtWidgets.QAction(MainWindow)
self.actionOPEN_Team.setObjectName("actionOPEN_Team")
self.actionSAVE_Team = QtWidgets.QAction(MainWindow)
self.actionSAVE_Team.setObjectName("actionSAVE_Team")
self.actionEVALUATE_Team = QtWidgets.QAction(MainWindow)
self.actionEVALUATE_Team.setObjectName("actionEVALUATE_Team")
#self.actionEVALUATE_Team.triggered.connect(self.OpenWindow)
self.menuManage_Teams.addAction(self.actionNEW_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionOPEN_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionSAVE_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionEVALUATE_Team)
self.menubar.addAction(self.menuManage_Teams.menuAction())
#self.listW1.itemDoubleClicked.connect(self.removelist1)
#self.listW2.itemDoubleClicked.connect(self.removelist2)
self.rb1.clicked.connect(self.fillList)
self.rb2.clicked.connect(self.fillList)
self.rb3.clicked.connect(self.fillList)
self.rb4.clicked.connect(self.fillList)
#self.menuManage_Teams.triggered[QtWidgets.QAction].connect(self.menu)
self.bat=0
self.bwl=0
self.ar=0
self.wk=0
self.avl=1000
self.used=0
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Fantasy Cricket Game"))
self.label.setText(_translate("MainWindow", "Your Selections"))
self.label_8.setText(_translate("MainWindow", "Batsmen(BAT)"))
self.l1.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "Bowlers(BOW)"))
self.l2.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_5.setText(_translate("MainWindow", "Allrounders(AR)"))
self.l3.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_3.setText(_translate("MainWindow", "Wicket-keeper(WK)"))
self.l4.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_13.setText(_translate("MainWindow", "Points Available"))
self.l5.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.label_11.setText(_translate("MainWindow", "Points Used"))
self.l6.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.rb1.setText(_translate("MainWindow", "BAT"))
self.rb2.setText(_translate("MainWindow", "BOW"))
self.rb3.setText(_translate("MainWindow", "AR"))
self.rb4.setText(_translate("MainWindow", "WK"))
self.label_14.setText(_translate("MainWindow", "Team Name"))
self.l7.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">Displayed Here</span></p></body></html>"))
self.label_16.setText(_translate("MainWindow", ">"))
self.menuManage_Teams.setTitle(_translate("MainWindow", "Manage Teams"))
self.actionNEW_Team.setText(_translate("MainWindow", "NEW Team"))
self.actionOPEN_Team.setText(_translate("MainWindow", "OPEN Team"))
self.actionSAVE_Team.setText(_translate("MainWindow", "SAVE Team"))
self.actionEVALUATE_Team.setText(_translate("MainWindow", "EVALUATE Team"))
def fillList(self):
curcricket = MyCricket.cursor()
if self.rb1.isChecked(): # Only showing for radiobutton1 code for rest buttons are similar.
print("HELP")
curcricket.execute("SELECT * FROM Stats WHERE Ctg = BAT;") # This is breaking my code, i added 2 print 'help' to check this breaking.
print("HELP")
BT = curcricket.fetchall()
self.listW1.clear()
for i in range(len(BT)):
item1 = QtWidgets.QListWidgetItem(BT[i][0])
font = QtGui.QFont()
font.setFamily("Comic Sans MS")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
item1.setFont(font)
self.listW1.addItem(item1)
curcricket.close()
if __name__ == "__main__":
import sqlite3
MyCricket=sqlite3.connect('MyCricket.db')
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
My application contains Qradiobuttons(BAT,BWL,AR,WK) and QlistWidgets
Whenever radio buttons are clicked i want my list widget to be filled with my Stats Table (only column 1 i.e "Player"(player-name) of particular Category column 7 i.e "Ctg" (BAT,BWL..) ) of database MyCricket.db. Im stuck with this problem and im not able to proceed futher. I wasted a lot of time searching over internet but didnt find a soln to this,I'm still researching so if anyone has the answer, please let me know.
python-3.x sqlite pyqt pyqt5 qt-designer
Select query is not executing in python3-sqlite3, instead my program breaks right after that statement. My code is running fine with no errors but whenever i click on radio button (in GUI) which calls a function containing above execute statement ,it breaks.
I'm new to sqlite3 and even python3, I'm working on my first python project which is built using above 2 and Qt designer, after converting my code from qtdesigner i added necessary codes, here's MyCricket.py code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QPushButton, QRadioButton, QFrame, QMessageBox)
from DialogBox2 import Ui_Dialog
from PyQt5.QtCore import pyqtSlot, QRect
class Ui_MainWindow(object):
def setupUi(self,MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(730, 562)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(20, 30, 101, 21))
font = QtGui.QFont()
font.setPointSize(9)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 60, 681, 61))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout.addWidget(self.label_8)
self.l1 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l1.setFont(font)
self.l1.setObjectName("l1")
self.horizontalLayout.addWidget(self.l1)
self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.horizontalLayout.addWidget(self.label_9)
self.l2 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l2.setFont(font)
self.l2.setObjectName("l2")
self.horizontalLayout.addWidget(self.l2)
self.label_5 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.l3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l3.setFont(font)
self.l3.setObjectName("l3")
self.horizontalLayout.addWidget(self.l3)
self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.horizontalLayout.addWidget(self.label_3)
self.l4 = QtWidgets.QLabel(self.horizontalLayoutWidget)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.l4.setFont(font)
self.l4.setObjectName("l4")
self.horizontalLayout.addWidget(self.l4)
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 130, 681, 51))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_13 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_13.setFont(font)
self.label_13.setObjectName("label_13")
self.horizontalLayout_2.addWidget(self.label_13)
self.l5 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l5.setFont(font)
self.l5.setObjectName("l5")
self.horizontalLayout_2.addWidget(self.l5)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(8)
font.setBold(True)
font.setWeight(75)
self.label_11.setFont(font)
self.label_11.setObjectName("label_11")
self.horizontalLayout_2.addWidget(self.label_11)
self.l6 = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.l6.setFont(font)
self.l6.setObjectName("l6")
self.horizontalLayout_2.addWidget(self.l6)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.listW1 = QtWidgets.QListWidget(self.centralwidget)
self.listW1.setGeometry(QtCore.QRect(30, 230, 261, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW1.setFont(font)
self.listW1.setObjectName("listW1")
item = QtWidgets.QListWidgetItem()
self.listW2 = QtWidgets.QListWidget(self.centralwidget)
self.listW2.setGeometry(QtCore.QRect(350, 230, 281, 271))
font = QtGui.QFont()
font.setFamily("Arial")
font.setBold(True)
font.setWeight(75)
self.listW2.setFont(font)
self.listW2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.listW2.setObjectName("listW2")
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(30, 190, 261, 51))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.rb1 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb1.setObjectName("rb1")
self.horizontalLayout_3.addWidget(self.rb1)
self.rb2 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb2.setObjectName("rb2")
self.horizontalLayout_3.addWidget(self.rb2)
self.rb3 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb3.setObjectName("rb3")
self.horizontalLayout_3.addWidget(self.rb3)
self.rb4 = QtWidgets.QRadioButton(self.horizontalLayoutWidget_3)
self.rb4.setObjectName("rb4")
self.horizontalLayout_3.addWidget(self.rb4)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(350, 190, 281, 51))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem2)
self.label_14 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_14.setFont(font)
self.label_14.setObjectName("label_14")
self.horizontalLayout_4.addWidget(self.label_14)
self.l7 = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
self.l7.setObjectName("l7")
self.horizontalLayout_4.addWidget(self.l7)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem3)
self.label_16 = QtWidgets.QLabel(self.centralwidget)
self.label_16.setGeometry(QtCore.QRect(310, 320, 21, 41))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(False)
font.setWeight(50)
self.label_16.setFont(font)
self.label_16.setObjectName("label_16")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 730, 21))
self.menubar.setObjectName("menubar")
self.menuManage_Teams = QtWidgets.QMenu(self.menubar)
self.menuManage_Teams.setObjectName("menuManage_Teams")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionNEW_Team = QtWidgets.QAction(MainWindow)
self.actionNEW_Team.setObjectName("actionNEW_Team")
self.actionOPEN_Team = QtWidgets.QAction(MainWindow)
self.actionOPEN_Team.setObjectName("actionOPEN_Team")
self.actionSAVE_Team = QtWidgets.QAction(MainWindow)
self.actionSAVE_Team.setObjectName("actionSAVE_Team")
self.actionEVALUATE_Team = QtWidgets.QAction(MainWindow)
self.actionEVALUATE_Team.setObjectName("actionEVALUATE_Team")
#self.actionEVALUATE_Team.triggered.connect(self.OpenWindow)
self.menuManage_Teams.addAction(self.actionNEW_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionOPEN_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionSAVE_Team)
self.menuManage_Teams.addSeparator()
self.menuManage_Teams.addAction(self.actionEVALUATE_Team)
self.menubar.addAction(self.menuManage_Teams.menuAction())
#self.listW1.itemDoubleClicked.connect(self.removelist1)
#self.listW2.itemDoubleClicked.connect(self.removelist2)
self.rb1.clicked.connect(self.fillList)
self.rb2.clicked.connect(self.fillList)
self.rb3.clicked.connect(self.fillList)
self.rb4.clicked.connect(self.fillList)
#self.menuManage_Teams.triggered[QtWidgets.QAction].connect(self.menu)
self.bat=0
self.bwl=0
self.ar=0
self.wk=0
self.avl=1000
self.used=0
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Fantasy Cricket Game"))
self.label.setText(_translate("MainWindow", "Your Selections"))
self.label_8.setText(_translate("MainWindow", "Batsmen(BAT)"))
self.l1.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "Bowlers(BOW)"))
self.l2.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_5.setText(_translate("MainWindow", "Allrounders(AR)"))
self.l3.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_3.setText(_translate("MainWindow", "Wicket-keeper(WK)"))
self.l4.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">##</span></p></body></html>"))
self.label_13.setText(_translate("MainWindow", "Points Available"))
self.l5.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.label_11.setText(_translate("MainWindow", "Points Used"))
self.l6.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">####</span></p></body></html>"))
self.rb1.setText(_translate("MainWindow", "BAT"))
self.rb2.setText(_translate("MainWindow", "BOW"))
self.rb3.setText(_translate("MainWindow", "AR"))
self.rb4.setText(_translate("MainWindow", "WK"))
self.label_14.setText(_translate("MainWindow", "Team Name"))
self.l7.setText(_translate("MainWindow", "<html><head/><body><p><span style=" color:#00aa00;">Displayed Here</span></p></body></html>"))
self.label_16.setText(_translate("MainWindow", ">"))
self.menuManage_Teams.setTitle(_translate("MainWindow", "Manage Teams"))
self.actionNEW_Team.setText(_translate("MainWindow", "NEW Team"))
self.actionOPEN_Team.setText(_translate("MainWindow", "OPEN Team"))
self.actionSAVE_Team.setText(_translate("MainWindow", "SAVE Team"))
self.actionEVALUATE_Team.setText(_translate("MainWindow", "EVALUATE Team"))
def fillList(self):
curcricket = MyCricket.cursor()
if self.rb1.isChecked(): # Only showing for radiobutton1 code for rest buttons are similar.
print("HELP")
curcricket.execute("SELECT * FROM Stats WHERE Ctg = BAT;") # This is breaking my code, i added 2 print 'help' to check this breaking.
print("HELP")
BT = curcricket.fetchall()
self.listW1.clear()
for i in range(len(BT)):
item1 = QtWidgets.QListWidgetItem(BT[i][0])
font = QtGui.QFont()
font.setFamily("Comic Sans MS")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
item1.setFont(font)
self.listW1.addItem(item1)
curcricket.close()
if __name__ == "__main__":
import sqlite3
MyCricket=sqlite3.connect('MyCricket.db')
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
My application contains Qradiobuttons(BAT,BWL,AR,WK) and QlistWidgets
Whenever radio buttons are clicked i want my list widget to be filled with my Stats Table (only column 1 i.e "Player"(player-name) of particular Category column 7 i.e "Ctg" (BAT,BWL..) ) of database MyCricket.db. Im stuck with this problem and im not able to proceed futher. I wasted a lot of time searching over internet but didnt find a soln to this,I'm still researching so if anyone has the answer, please let me know.
python-3.x sqlite pyqt pyqt5 qt-designer
python-3.x sqlite pyqt pyqt5 qt-designer
edited Apr 20 at 11:11
marc_s
589k13111281277
589k13111281277
asked Mar 23 at 15:18
rohit523rohit523
11
11
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from theMainWindow
class, not fromUi_*
.
– TrebledJ
Mar 23 at 15:36
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25
|
show 2 more comments
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from theMainWindow
class, not fromUi_*
.
– TrebledJ
Mar 23 at 15:36
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from the
MainWindow
class, not from Ui_*
.– TrebledJ
Mar 23 at 15:36
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from the
MainWindow
class, not from Ui_*
.– TrebledJ
Mar 23 at 15:36
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315228%2fpython-sqlite3-program-breaking-after-calling-execute-select-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315228%2fpython-sqlite3-program-breaking-after-calling-execute-select-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't use PyQt, but generally on Qt/C++, one doesn't need to modify the code auto-generated by QtDesigner... Usually one calls it from the
MainWindow
class, not fromUi_*
.– TrebledJ
Mar 23 at 15:36
@TrebledJ Its completely fine to modify code generated by Qt designer(i have tried it before too), we make modules to call them in main program for just simplicity (mostly in cases involving long lines of codes)
– rohit523
Mar 23 at 17:42
@S.Nick I have added whole setupUi class(spaces in btw indicate addition of statements in code) ,theres no error in this code it runs fine but breaks in the execute statement (Whenever radio button is clicked)in fillList method...
– rohit523
Mar 23 at 18:08
@rohit523 share your MyCricket.db
– eyllanesc
Mar 23 at 20:05
@eyllanesc github.com/rohit523/project.git , sorry for uplaoding late.. i was a little busy today...and im also new to github so was checking how to share files..please let me know if you find the answer, thanks!
– rohit523
Mar 24 at 16:25