Hi,

If you want to learn how to create pop up windows, menus, etc. for GTK3 I
would suggest having a look at:
http://python-gtk-3-tutorial.readthedocs.io/en/latest/

The way I did it is to call graph_widget = GraphWidget() and then attach it
to a window created based on the tutorial mentioned above. That allows you
to add menus, tool bars, staus bars etc as you please.

Regarding having the SW respond to keyboard commands, you can do it by
using the "key_press_call_back" parameter. This is a function that is
called every time a key is pressed:

For example:
graph_widget = GraphWidget(g, ....,
key_press_callback=key_pressed_callback) # note i omitted lots of other
parameters

where key_pressed_callback is a funtion defined as:

def_key_pressed_callback(self, widget, g, key, selected_vertices, pos,
vprops, eprops):
    if chr(key) == 'd':
        print("User pressed:" +  chr(key))

Hope that helps




On Wed, Aug 10, 2016 at 2:22 AM, Глеб Киселев <[email protected]>
wrote:

> Could you give me a little sample code, if you is not too much trouble?
>
> I just found a function *key_press_callback *from GraphWidget. Im new in
> Python so its hard to understand its work by myself without doc. I'll be
> very greatefull to you)
>
> 06.08.16 13:00, [email protected] пишет:
>
> Send graph-tool mailing list submissions to
>       [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.skewed.de/mailman/listinfo/graph-tool
> or, via email, send a message with subject or body 'help' to
>       [email protected]
>
> You can reach the person managing the list at
>       [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of graph-tool digest..."
>
>
> Today's Topics:
>
>    1. Re: pop-up windows in graph-tool (Tiago de Paula Peixoto)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 5 Aug 2016 14:06:41 +0100
> From: Tiago de Paula Peixoto <[email protected]> <[email protected]>
> To: Main discussion list for the graph-tool project
>       <[email protected]> <[email protected]>
> Subject: Re: [graph-tool] pop-up windows in graph-tool
> Message-ID: <[email protected]> 
> <[email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> On 03.08.2016 14:46, ???? ??????? wrote:
>
> Im trying to make graph layout for different planning algorithms on
> python3. I made this normally, but I need to create a pop-up window,
> that will blow up after click on vertex, with text from propety of
> vertex. I didnt find any material for this in WEB, can you give me
> some advises about that?
>
> Although this is possible to do, it is currently completely
> undocumented.
>
> At the moment, the best you can do is look into the source code, and try
> to figure it out.
>
> Best,
> Tiago
>
>
>
>
> _______________________________________________
> graph-tool mailing list
> [email protected]
> https://lists.skewed.de/mailman/listinfo/graph-tool
>
>
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to