hackish_pygtk_things
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Entrambe le parti precedenti la revisioneRevisione precedenteProssima revisione | Revisione precedente | ||
hackish_pygtk_things [2008/12/23 00:51] – pointer pietro | hackish_pygtk_things [2009/01/09 15:22] (versione attuale) – treeviews pietro | ||
---|---|---|---|
Linea 6: | Linea 6: | ||
So | So | ||
- | mywidget.add_events(gtk.gdk.BUTTON_RELEASE_MASK) | + | |
- | mywidget.connect(" | + | mywidget.connect(" |
won't do, while | won't do, while | ||
- | mywidget.add_events(gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.BUTTON_PRESS_MASK) | + | |
- | mywidget.connect(" | + | mywidget.connect(" |
will. | will. | ||
+ | |||
+ | == Release outside widget == | ||
+ | |||
+ | Notice that - this may seem hackish but is very smart - release events are targeted to the widget over which the button was pressed, not to the one over which it was released (the only case where you need to know that a button pressed on some other widget was released on yours is drag and drop, which has its own methods). | ||
==== Motion hints ==== | ==== Motion hints ==== | ||
- | According to the laconic [[file:///usr/ | + | According to the laconic [[http://www.pygtk.org/docs/ |
However, this is plainly false in pygtk 2.13.0, where instead: | However, this is plainly false in pygtk 2.13.0, where instead: | ||
* if you only add gtk.gdk.POINTER_MOTION_HINT_MASK to your event mask, you handler for " | * if you only add gtk.gdk.POINTER_MOTION_HINT_MASK to your event mask, you handler for " | ||
- | * if you instead add gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.POINTER_MOTION_MASK , your handler is called lots of times, even if you don't call get_pointer() | + | * if you instead add gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.POINTER_MOTION_MASK , your handler is called lots of times, even if you don't call get_pointer() |
- | There are two possible explanations: | + | There are 3 possible explanations: |
- pygtk looks if you are calling get_pointer //into you handler//, but if you don't and the handler ends execution, assumes that you are just ready for a new event (quite arbitrary and useless, since then pygtk could just | - pygtk looks if you are calling get_pointer //into you handler//, but if you don't and the handler ends execution, assumes that you are just ready for a new event (quite arbitrary and useless, since then pygtk could just | ||
- documentation is wrong/ | - documentation is wrong/ | ||
- recent pygtk versions are buggy | - recent pygtk versions are buggy | ||
- | I see 2 or 3 as more probable, because the widget provided in [[http:// | + | I see 2 or 3 as more probable, because the widget provided in [[http:// |
+ | |||
+ | Moreover, since [[http:// | ||
+ | |||
+ | ====== TreeViews and CellRenderers ====== | ||
+ | |||
+ | The ' | ||
+ | |||
+ | The ' | ||
+ | gtk.rc_parse_string(""" | ||
+ | GtkTreeView:: | ||
+ | } | ||
+ | |||
+ | class " | ||
+ | """ |
hackish_pygtk_things.1229989871.txt.gz · Ultima modifica: 2008/12/23 00:51 da pietro