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)
>>>