I'm starting to make some tests/examples for an app I have to develop.
I wrote the example using cairo and it works. Basically I tried to
render a white rectangle with a black border in the following way:

    def draw_rect(self):
        self.context.rectangle(5, 5, 150, 150)
        self.context.set_source_rgb(1, 1, 1)
        self.context.fill_preserve()
        self.context.set_source_rgb(0, 0, 0)
        self.context.stroke()

Since I can't make Pycairo + Pygtk work under Win32 (the final app
runs on win but I develop under linux) I can't use Cairo API and hence
I tried with gtk.Drawable methods but I don't know how to get the same
result in a prettier way than this one:

    def draw_rect(self):
        cmap = self.get_colormap()
        self.context.foreground = cmap.alloc_color("#000")
        self.window.draw_rectangle(self.context, False, 5, 5, 150, 150)
        self.context.foreground = cmap.alloc_color("#FFF")
        self.window.draw_rectangle(self.context, True, 6, 6, 149, 149)

I don't want to render 2 rectangles only to change the border colour

Anybody knows how to do it without doubling rendered stuff on the canvas?

--
Lawrence
http://www.oluyede.org/blog
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to