Strumenti Utente

Strumenti Sito


pygtk:overriding

Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

pygtk:overriding [2009/01/14 09:37] – overriding pietropygtk:overriding [2009/01/14 09:47] (versione attuale) – bug pietro
Linea 15: Linea 15:
   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'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//
pygtk/overriding.1231922272.txt.gz · Ultima modifica: 2009/01/14 09:37 da pietro