0
votes

this may look like this question already appeared and in fact it was already touched in this topic Parallel drawing with GTK and Cairo in Python 3 . However is it possible there is another solution to this problem?

To start with, I have created UI in PyGtk with my custom animations executed with the use of threading (Gtk.threads_enter() and Gtk.threads_leave()). It works good and gives out no errors. I also wanted to add some kind of point cloud and I saw that Cairo may be a good fit for it with supposedly support for Gtk.DrawingArea to handle it.

Here is where problem starts. Due to Cairo using drawing event and pretty much overriding it, it draws over my UI the image I made for Gtk.DrawingArea.Image of cairo drawing over UI

So image appears in DrawingArea and is drawn once again over every UI element. I used this tutorial https://blog.fossasia.org/creating-animations-in-gtk-with-pycairo-in-susi-linux-app/ to draw Cairo animation.

Is there a way to somehow make drawing calls from PyGTK to redraw UI elements, so they are not overdrawn by Cairo?

1

1 Answers

0
votes

I answered my own question. Draw call needs to be in its own class for DrawingArea as in example https://blog.fossasia.org/creating-animations-in-gtk-with-pycairo-in-susi-linux-app/

I tried to connect it with my own main class but then it was redrawing whole window instead of redrawing only DrawingArea. So when you want to use Cairo, remember to make DrawingArea a custom class.