[pygtk] passing data to actions invoked by popup

Nikos Kouremenos kourem at gmail.com
Fri Mar 31 05:21:10 WST 2006


menu.popup() normally accepts additonal data. but PyGTK devs wrapped
it bad so in PyGTK world it doesn't. I have reported this in BT.

your ugly solution is what I also do. well not global but class
variable which is the same 'bad'

On 3/30/06, N. Volbers <mithrandir42 at web.de> wrote:
> Hello everyone,
>
> in my applications I have different tool widgets, very similar to the
> dockable tools in gimp, and they all have a button at the top-right that
> opens up a popup menu when pressed. This popup allows to add other
> tools, so for this reason, the popup is always the same.
>
> Unfortunately, this means that since every popup is the same, the
> corresponding actions are always the same as well. There seems to be no
> way to know from which tool instance the popup was called. So my
> question is: Is there any way to add certain extra information when
> popping up a menu, so that when an action is triggered, this extra
> information is passed on to the callback ?
>
> My current solution is rather ugly: Before calling menu.popup, I set a
> global variable to hold this extra information, so that the callback can
> retrieve it.
>
> Niklas Volbers.
>
>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>



--
Nikos Kouremenos


More information about the pygtk mailing list