GraphWidget with background image

Hello Tiago,

I finished implementing the background image in GraphWidget. I attached the
files so you can see the result. You just need to run the file named
test_window.py within an environment with graph-tool installed. I think
that it only works with PNG image files, because I used the method

cairo.ImageSurface.create_from_png()

During this development I have found some difficult to use the key press
events when the GraphWidget is inside a Gtk container. I was trying to set
a GraphWidget inside the Gtk.Overlay, which is set inside a Gtk.Notebook
page. In this configuration all the events with scroll and control key
worked perfectly, but when I press the keys 'a', 's' or 'r' nothing
happens. Do you have any idea why this occurs?

I had another problem related with the docker image when I was developing
the GUI. All the text outside the GraphWidget was shown as a undefined
character, like small squares. I thought that happened because the Arch
Linux is messing with the fonts. So I created a new Dockerfile using Ubuntu
16.04 and compiled with graph-tool. This way I had no problem with the font.

I hope this help in some way. :slight_smile:

Regards,
Paulo Nascimento

attachment.html (1.52 KB)

dados_animais.txt (189 Bytes)

gtk_graph_draw.py (52.2 KB)

terrain.png

test_window.py (3.01 KB)

During this development I have found some difficult to use the key press
events when the GraphWidget is inside a Gtk container. I was trying to set a
GraphWidget inside the Gtk.Overlay, which is set inside a Gtk.Notebook page.
In this configuration all the events with scroll and control key worked
perfectly, but when I press the keys 'a', 's' or 'r' nothing happens. Do you
have any idea why this occurs?

The events are probably caught by the parent widget, so maybe you have to
handle it there, or just configure it to propagate it forward.

I had another problem related with the docker image when I was developing
the GUI. All the text outside the GraphWidget was shown as a undefined
character, like small squares. I thought that happened because the Arch
Linux is messing with the fonts. So I created a new Dockerfile using Ubuntu
16.04 and compiled with graph-tool. This way I had no problem with the font.

If that is the case, you can just install the fonts from Arch, there is no
need to start from scratch just for that. I will investigate and add the
fonts if necessary.

Best,
Tiago