[pygtk] gtk.drawingarea troubles

Chris Cole ccole2 at mix.wvu.edu
Fri Jul 13 04:42:15 WST 2007


Hey all,
I'm trying to draw a simple image(pixbuf) onto a gtk.drawingarea
in the upper left corner, but I can't get even get my white background 
to show up...I'm not sure what I'm doing wrong - here's my code:

         draw_area = self.wTree.get_widget('draw_area')
         draw_area.set_size_request(1280, 66)
         draw_area.realize() 

         gdkwin = draw_area.window
         gc = gdkwin.new_gc(foreground=gtk.gdk.color_parse('black'),
                       background=gtk.gdk.color_parse('white'))


         pixbuf = gtk.gdk.pixbuf_new_from_file('foo.gif')
         gdkwin.draw_pixbuf(gc, pixbuf, src_x=0, src_y=0,
                            dest_x=150, dest_y=66, width=150,
                            height=66, dither=gtk.gdk.RGB_DITHER_NORMAL,
                            x_dither=0, y_dither=0)


Thanks,
   -cc


More information about the pygtk mailing list