File: helloscript.py

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (21 lines) | stat: -rwxr-xr-x 499 bytes parent folder | download
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

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

import sys
from PyQt4 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_())