I'm following Tech With Tim's tutorial on PyQt5 Video Link
I'm using PyCharm for this. Here's My Current Code
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
class MyWindow(QMainWindow):
def __init__(self):
super(MyWindow, self).__init__()
self.setGeometry(200, 200, 500, 500)
self.setWindowTitle("Data")
self.initUI()
def initUI(self):
self.label1 = QtWidgets.QLabel(self)
self.label1.setText("Hello World")
self.label1.move(225, 250)
self.button1 =QtWidgets.QPushButton(self)
self.button1.setText("Click Me")
self.button1.move(200, 200)
self.button1.clicked.connect(self.pressed())
def pressed(self):
self.label1.setText("You Clicked")
def window():
app = QApplication(sys.argv)
win = MyWindow()
win.show()
sys.exit(app.exec_())
window()
I get a problem that says "Cannot find reference 'connect' in 'function' " Of course I first tried searching google but they revolve around PyQt4 which I assumed won't answer my problem.