开发者

gtk drawing set background image

开发者 https://www.devze.com 2023-01-05 18:56 出处:网络
I have a drawing area, and an \'png\' image I want to load that image to my drawing area as background.

I have a drawing area, and an 'png' image I want to load that image to my drawing area as background.

the screen is bigger then my image and the problem is it does not 'tile' my image

I have tried adding image as 开发者_如何学Gopixbuf and pixmap but it doesnot help

i use this line

gc.set_tile(pixmap)
area.window.draw_drawable(gc, pimap, .....)

but it does not help


i found the answer i put the code here for others

area=gtk.Drawingarea()

pixbuf=gtk.gdk.pixbuf_new_from_file('background.png')
pixmap, mask=pixbuf.render_pixmap_and_mask()

area.window.set_back_pixmap(pixmap, False)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号