#!/usr/bin/env python

import pygtk
import gtk

class MyArea(gtk.DrawingArea):
	def __init__(self):
		gtk.DrawingArea.__init__(self)
		
		self.set_size_request(200,200)
		self.connect('expose-event', self.expose)
	
	def expose(self, something, somethingelse):
		x, y, w, h = self.get_allocation()
		
		grey = gtk.gdk.Color('grey')

		self.window.get_colormap().alloc_color(grey)
		gc = self.get_style().black_gc
		#gc = self.window.new_gc()

		print "Before", repr(gc.foreground)
		gc.foreground = grey
		print "Assignment", repr(grey)
		print "After", repr(gc.foreground)

		print "Blue value before", gc.foreground.blue
		gc.foreground.blue = 65535
		print "Blue value after", gc.foreground.blue
		
		self.window.draw_rectangle(gc, True, 0, 0, w, h)

w = gtk.Window()
d = MyArea()
w.add(d)
d.show()
w.show()
gtk.main()
