gtk drawing set background image

霸气de小男生 提交于 2019-12-02 18:56:13

问题


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 pixbuf 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


回答1:


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)


来源:https://stackoverflow.com/questions/3150706/gtk-drawing-set-background-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!