Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.52 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Difference between connect() and connect_object() in pygtk
  2. >>> label = gtk.Label()
  3. >>> button = gtk.Button()
  4. >>> def callback(obj):
  5. ...    print obj
  6. >>> button.connect('clicked', callback)  # button will be passed by default
  7. >>> button.emit('clicked')
  8. <gtk.Button object at 0x27cd870 (GtkButton at 0x22c6190)>
  9. >>> button.disconnect_by_func(callback)
  10. >>> button.connect_object('clicked', callback, label)  # label will be passed instead of button
  11. >>> button.emit('clicked')
  12. <gtk.Label object at 0x27cd9b0 (GtkLabel at 0x22b64f0)>