I have the following in my Python file: import sys
from PyQt4.QtCore import QDateTime, QObject, QUrl, pyqtSignal from PyQt4.QtGui import QApplication from PyQt4.QtDeclarative import QDeclarativeView #this class will emit success if photo is added to group class updateGroup(QObject): now = pyqtSignal(int) def emit_now(self): number = 1 self.now.emit(number) app = QApplication(sys.argv) update = updateGroup() view = QDeclarativeView() view.setSource(QUrl('flickrviews.qml')) view.setResizeMode(QDeclarativeView.SizeRootObjectToView) rootObject = view.rootObject() rootObject.updateRequired.connect(update.emit_now) #sends signal update.now.connect(rootObject.updateColor) #tells it which function in qml gets that signal view.setGeometry(100, 100, 400, 240) view.show() app.exec_() and the relevant parts in my QML file are: signal updateRequired; function updateColor(number) { if(number==1) { addtogroup.buttonColor="blue" } } and later in the file: Button{ id: addtogroup width: 200 bLabel: "Add to Next Group" //onButtonClick: plasmoid.runCommand("/home/ermesa/bin/qml/plasmoids/flickrviews2/contents/ui/flickrhelpers/addtogroup.py", [photoID,nextphotogroup]) onButtonClick: updateRequired() } Just curious about one thing: 1) With this framework I can get information from the python program to affect the QML (and change the button to a blue colour). How do I get information to the python program? In other words, if I have a python function that's function(int) -> how do I provide the int argument for the python FROM the QML? It's a little hard for me to figure out because this stuff is all indirect - in the QML the signal is referred to as if it were a function. And the function gets the data from the signal, but it doesn't seem to make sense how that happens because there's no real link to it. I kinda understand what I'm doing, but not enough to figure out how to get the into to python. Thanks, -- Eric Mesa http://about.me/ericmesa http://www.ericsbinaryworld.com
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel