My PyQt5 Project. A simple button clicked event do some printing and capture the execution time.
The problem is, each time I click the button, the execution time increase as compared to previous cycle. Any idea what is the cause?
These are the execution time result:
Cycle 1: 3.027s
Cycle 2: 3.302
Cycle 3: 3.594
Cycle 4: 3.848
I am running on Windows 10, Python 3.8.8, PyQt5 5.15.1
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
uic.loadUi("./package/ui/MainWindow.ui", self)
#==============================Form loaded===============================
self.button_Test.clicked.connect(self.button_Test_Clicked)
def button_Test_Clicked(self):
print("button clicked")
print(colorama.ansi.clear_screen())
self.start_time = time.time()
y = 0
for x in range (0, 30000):
y = x * 2
print(y)
print(y)
self.elapse_time = time.time() - self.start_time
print("Test Execution time = " + str(self.elapse_time))