Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
| |
pygtk:overriding [2009/01/14 09:37] – overriding pietro | pygtk:overriding [2009/01/14 09:47] (versione attuale) – bug pietro |
---|
label = MyLabel() | label = MyLabel() |
| |
; this works for (as far as I know) **all** pygtk methods: it is sufficient to add //do_// in front of the name of a method. Notice, however, that the //do_*// method doesn't accept the same arguments as the original, neither return the same values. For instance, in our case, while size_request is called by just giving the instance as argument, and returns a tuple, do_size_request is called with two arguments: the instance and a //requisition//, and instead of returning the two dimensions, it sets them as //requisition.width// and //requisition.height// | ; this works for (as far as I know) **all** pygtk methods: it is sufficient to add //do_// in front of the name of a method. Notice, however, that the //do_*// method doesn't necessarily accept the same arguments as the original, neither return the same values (and also notice that as of January 2009, [[http://bugzilla.gnome.org/show_bug.cgi?id=567489|there is a bug]] which makes error messages totally misleading). For instance, in our case, while size_request is called by just giving the instance as argument, and returns a tuple, do_size_request is called with two arguments: the instance and a //requisition//, and instead of returning the two dimensions, it sets them as //requisition.width// and //requisition.height// |