Simple Button Click Connection To Python Function
I have a very simple Qml/Python application with some content in a StackView(), with the first page containing a simple button. My question is, does EVERYTHING between Qml and Pyth
Solution 1:
Explanation:
QML uses the MetaObject (MOC) of the QObjects to access the properties, signals and slots, in your case changePage is not a slot but a function that is not accessible from QML.
Answer :
The solution is to make the changePage function accessible in QML using the @pyqtSlot decorator:
homeFunctions.py
from PyQt5.QtCore import pyqtSlot, QObject
classHomeFunctions(QObject):
@pyqtSlot()defchangePage(self):
print("Button was pressed")
Post a Comment for "Simple Button Click Connection To Python Function"