cannot draw green rectangle on GdkWindow(GtkDrawingArea.window)
- From: Todong Ma <gbstack08 gmail com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: cannot draw green rectangle on GdkWindow(GtkDrawingArea.window)
- Date: Sat, 26 Mar 2011 10:48:48 +0000
Hi,everyone.I want to draw green rectangle on a drawable,following is my
code:
*import gobject
import gtk
import pygtk
def expose(widget,event):
x,y,width,height = event.area
green = gtk.gdk.Color(0,10000,0)
gc = gtk.gdk.GC(widget.window)
gc.set_foreground(green)
gc2 = widget.window.new_gc(green)
widget.window.draw_rectangle(widget.get_style().white_gc,True,0,0,width,height)
widget.window.draw_rectangle(gc,True,100,100,30,30)
widget.window.draw_rectangle(gc2,True,30,30,30,30)
w = gtk.Window(gtk.WINDOW_TOPLEVEL)
canvas = gtk.DrawingArea()
w.resize(300,300)
w.add(canvas)
canvas.connect('expose_event',expose)
gtk.Widget.show_all(w)
gtk.main()*
I have invoked gtk.gdk.GC.set_foreground() to set the foreground color for
gc,but what I see is only two BLACK rectangles...
what should I do to solve this problem?
Any suggestion is appreciated.:)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]