I have a program. When I click on the "Hello" button, my cursor changes (within 5 seconds) (the cursor is the mouse cursor). Is this a bug or am I doing something wrong? Why does my cursor change for five seconds? What can I do to keep the cursor from changing?
import sys
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication, QPushButton,QLabel
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QTime, QTimer, Qt, QRect
class Example2(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.statusBar()
self.setGeometry(300, 300, 300, 200)
btn2 = QPushButton("Cat", self)
btn2.resize(btn2.sizeHint())
btn2.move(50,50)
btn2.clicked.connect(self.buttonClicked)
lbl1 = QLabel("We like it", self)
lbl1.setGeometry(QRect(50, 30, 150, 50))
lbl1.setScaledContents(True)
lbl1.updateGeometry()
lbl1.adjustSize()
self.show()
def buttonClicked(self):
pass
class Example1(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.statusBar()
self.setGeometry(300, 300, 300, 200)
btn1 = QPushButton("Hello", self)
btn1.resize(btn1.sizeHint())
btn1.move(50, 85)
btn1.clicked.connect(self.buttonClicked)
self.show()
def buttonClicked(self):
sender = self.sender()
if sender.text() == 'Hello':
self.hide()
self.Example2 = Example2()
self.Example2.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example1()
sys.exit(app.exec_())
print("Hello")