简体   繁体   中英

How to set background from image file in pygtk+ 3

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM