aboutsummaryrefslogtreecommitdiffstats
path: root/examples/script/helloscript.py
blob: 7974b95e76a2abd35ba664220041ba55b3848ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

"""PySide port of the script/helloscript example from Qt v4.x"""

import sys
from PySide2 import QtGui, QtScript


app = QtGui.QApplication(sys.argv)

engine = QtScript.QScriptEngine()

button = QtGui.QPushButton()
scriptButton = engine.newQObject(button)
engine.globalObject().setProperty("button", scriptButton)

engine.evaluate("button.text = 'Hello World!'")
engine.evaluate("button.styleSheet = 'font-style: italic'")
engine.evaluate("button.show()")

sys.exit(app.exec_())