Apologies if my title is unclear; I'm trying to retrieve some data from an SQLLite database (which is working) and show it to the user on a window in PyQt5. So far, I've managed to retrieve the result and print in Python, but when trying to add/view the results in the window Python simply crashes. I've inserted the code which isn't working below. (The indentation has gone slightly funny when copying it, but it is perfectly fine in my file).
class Profile(QWidget):
def __init__(self, Type):
super().__init__()
self.window = QWidget()
self.window.setGeometry(100,100, 350, 400)
self.window.setWindowTitle("Welcome")
self.window.show()
self.Choices()
def Choices(self):
self.layout = QGridLayout()
c.execute('''SELECT username, teamname FROM Users WHERE username = ?''',
(user,))
result = c.fetchone()
print(result)
print(user)
self.TeamInfo = QLabel(result)
self.layout.addWidget(self.TeamInfo)
self.window.setLayout(self.layout)
self.window.show()
user
is a global variable in a previous window (the log in page) to avoid the user having to reenter their username. This section is not included, as that is not the problem. All the other buttons in the class are working - it is just this particular section. Any help as to how to solve this is greatly appreciated, I figure the problem is the line self.TeamInfo = QLabel(result)
but I don't have the PyQT5 knowledge on how to solve this.
Edit: I have included a screenshot of the error message I'm getting.