On 17.11.2016 19:45, Xun Xiao wrote:
> Dear Tiago,
> 
> I am extending the functions of GraphWidget that visualizes the Graph()
> object. 
> 
> By default, in graph-tool, when right-click on the widget, the self.picked
> vertex (closest to the pointer) will be unselected.
> 
> However, i want to extend it so that 1) when right-click on the selected
> vertex, it popups a menu - let's say A, while 2) right-click on the
> background area, it first unselects the selected vertex and then popups
> another menu, let's say B.
> 
> I know that i have to overwrite the button_press_event(), but at the branch
> of event.button == 3, i cannot successfully differentiate the above two
> cases. Thanks a lot.

I think the easiest way to do this is not to modify the button_press_event()
but instead to register another callback to the same event. Please take a
look at the GTK documentation on this. If you have a question, you can ask
in the GTK users' mailing list, IRC channels, etc.

Best,
Tiago


-- 
Tiago de Paula Peixoto <[email protected]>
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to