Results 1 to 2 of 2

Thread: PyGobject Callback Signature

  1. #1
    Join Date
    Oct 2013
    Beans
    3

    PyGobject Callback Signature

    (I wasn't sure if I should post this here or in the 'Absolute Beginners' Section', but it's a development question, so I'll post it here.)

    I found several tutorials, like The Python GTK+ 3 Tutorial, which is pretty nice for a novice.

    I am struggling to find PyGObject documentation, I am not clear on the callback functions signature. In the above tutorial the connect() call looks like this

    Code:
    self.button.connect("clicked", self.on_button_clicked)
    and the callback looks like this:

    Code:
    def on_button_clicked(self, widget):
              print("Hello World")
    the widget parameter being the button which connect() was called (am I right?). Elsewhere I have seen callbacks like this:

    Code:
    def on_button_clicked(self, widget, data=None):
              print("Hello World")
    On gnome.org I fount this:

    ' The required signature of a callback function is determined by the context in which is used (e.g. the signal to which it is connected).'

    I would like to know how could I determine the appropriate callback signature for any given signal. Thanks in advance.

  2. #2
    Join Date
    Oct 2013
    Beans
    3

    Re: PyGobject Callback Signature

    To answer the question, I should have read the documentation. For example GtkButton clicked signal.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •