I try to use Python in QML and I think Brython is a convenient javascript library to enable Python on-the-fly. But as far as I know Brython uses web browser tools only. Is it possible to embed Brython in QML in order to use it like back-end?
main.qml:
import QtQuick 2.0
import QtQuick.Window 2.2
import "sample.js" as Util
Window {
width:300 ; height:300
visible:true
Column{
TextEdit{
id:inputText
width:200
height:50
onAccepted{
result.text = Util.hello()
}
}
Text{
id:result
color:"blue"
}
}
}
}
sample.js:
import "brython_stdlib.js"
def hello():
return "hello world"