File: GettingStarted.py

package info (click to toggle)
pythonqt 2.1.0~svn247-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,852 kB
  • ctags: 60,757
  • sloc: cpp: 456,580; xml: 17,942; python: 64; sh: 19; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from PythonQt import *

# set the title of the group box, accessing the title property
box.title = 'PythonQt Example'

# set the html content of the QTextBrowser
box.browser.html = 'Hello <b>Qt</b>!'

# set the title of the button
box.button1.text = 'Append Text' 

# set the text of the line edit
box.edit.text = '42'

# define our own python method that appends the text from the line edit
# to the text browser
def appendLine():
  box.browser.append(box.edit.text)
    
# connect the button's clicked signal to our python method
box.button1.connect('clicked()', appendLine)
# connect the lineedit's returnPressed signal to our python method
box.edit.connect('returnPressed()', appendLine)

# show the window
box.show()