thriller localhost python Python r263 75183 Oct 2009 11 40 05 GCC on l

 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
thriller@localhost ~ :) python
Python 2.6.3 (r263:75183, Oct 4 2009, 11:40:05)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> def p(*a):
... print a
...
>>> bs = []
>>> for i in xrange(10):
... b = gtk.Button('Hi there')
... b.connect('clicked', p, len(bs))
... bs.append(b)
...
8L
9L
10L
11L
12L
13L
14L
15L
16L
17L
>>> bs[2].clicked()
(<gtk.Button object at 0xb7cf5c5c (GtkButton at 0x931c108)>, 2)
>>>