Виджет Pyqt5 Lcd не запускается время
Если запускать код виджета отдельно, он работает, а в проекте просто отображается, время не идет.
class ExampleApp(QtWidgets.QMainWindow, goldhunter.Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.build_handlers()
def build_handlers(self):
self.startwork.clicked.connect(self.on_button_click)
def on_button_click(self):
while keyboard.is_pressed("Esc") == False:
for f in files:
picture = "syndyk/" + f
button = pyautogui.locateOnScreen(picture, confidence = 0.95)
if button:
pyautogui.click(button)
pyautogui.sleep(0.1)
class Tests(QtWidgets.QWidget):
def __init__(self):
QtWidgets.QWidget.__init__(self, parent)
self.timer = QtCore.QTimer(self)
self.timer.timeout.connect(self.showTime)
self.timer.start(1000)
def showTime(self):
self.current_time = QtCore.QTime.currentTime()
self.strCurrentTime = self.current_time.toString('hh:mm')
self.ui.lcdNumber.display(self.strCurrentTime)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = Window()
form = Form()
form.setupUi(window)
window = ExampleApp()
window.show()
app.exec_()