summaryrefslogtreecommitdiff
path: root/examples/atk/atk-demo.py
blob: 5e2268bd87c72f14a4c3581a392d046e0a3a425d (plain)
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
28
29
30
31
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import atk

win = gtk.Window()
win.connect('destroy', lambda win: gtk.main_quit())

button = gtk.Button(stock=gtk.STOCK_QUIT)
button.connect('pressed', lambda button: gtk.main_quit())
atk_button = button.get_accessible()
atk_button.set_description('Be careful, clicking this button will exit')

label = gtk.Label('This label describes a button')
atk_label = label.get_accessible()
atk_label.set_description('This is a useless label')
relation_set = atk_label.ref_relation_set()

relation = atk.Relation((atk_button,), atk.RELATION_LABEL_FOR)
relation_set.add(relation)

box = gtk.HBox()
box.pack_start(label)
box.pack_start(button)

win.add(box)
win.show_all()

gtk.main()