I've searched among the documentation of Python, and PyGtk but i couldn't find the right syntax for a generic signal handler written by the programmer; i've just found the documentation for the classic API provided by the library(PyGtk).

This is the syntax for my function for every method i've in my modules:

def Continua_Button_clicked(self, widget, event, *args):

But is it correct?

How can i be sure i'll got the widget reference, the event that fired up the signal handler and the arguments of the event?

I'm a bit confused of what and how many arguments i'll got from each event, and how many arguments my signal handler will get.

有帮助吗?

解决方案

It depends on the signal what exactly is passed in; you'd consult the gkt.Widget signal documentation.

For example, the button-press-event signal expects:

def callback(widget, event, *user_params):

but child-notify will use:

def callback(widget, child_property, *user_params)

etc.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top