Question

How to set background from image file in pygtk+ 3 ? I tried with this but all the rest items in the application goes above it or below the image. I can change the bg colour with Gdk, but I want to see my custom made image in the background of the application.

image = Gtk.Image()
image.set_from_file("image.png")
self.add(image)
Was it helpful?

Solution

Three possibilities:

  • use CSS to specify the background image for your application window
  • use a Gtk.Overlay and put your image widget under the other widgets in the window
  • implement a custom do_draw function and render the background using Cairo before chaining up to the parent's implementation of do_draw
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top