File: completion.py

package info (click to toggle)
kiwi 1.9.22-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 11,908 kB
  • ctags: 5,549
  • sloc: python: 15,779; ansic: 193; xml: 77; makefile: 57; sh: 17
file content (34 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (4)
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
32
33
34
# encoding: iso-8859-1
import gtk

from kiwi.ui.widgets.entry import ProxyEntry

def on_entry_activate(entry):
    print 'You selected:', entry.read()
    gtk.main_quit()

win = gtk.Window()
win.connect('delete-event', gtk.main_quit)

vbox = gtk.VBox()
win.add(vbox)

# Normal entry
entry = ProxyEntry()
entry.data_type = str
entry.connect('activate', on_entry_activate)
entry.prefill(['Belo Horizonte', u'So Carlos',
               u'So Paulo',  u'Bstad',
               u'rnskldsvik', 'sanca', 'sampa'])
vbox.pack_start(entry)

entry = ProxyEntry()
entry.data_type = int
entry.connect('activate', on_entry_activate)
entry.prefill([('Brazil', 186),
               ('Sweden', 9),
               ('China', 1306)])
vbox.pack_start(entry)

win.show_all()
gtk.main()