gpiozero

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

时光总嘲笑我的痴心妄想 提交于 2021-02-07 17:29:22
问题 I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * import os, time, sys def btn_pressed(): global r return lambda: r.setProperty("source", "/home/pi/Desktop/example/sample/img/img1.jpg") button1 = Button(20) myApp = QGuiApplication([]) myEngine = QQmlApplicationEngine() directory = os.path.dirname(os

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

▼魔方 西西 提交于 2021-02-07 17:28:38
问题 I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * import os, time, sys def btn_pressed(): global r return lambda: r.setProperty("source", "/home/pi/Desktop/example/sample/img/img1.jpg") button1 = Button(20) myApp = QGuiApplication([]) myEngine = QQmlApplicationEngine() directory = os.path.dirname(os