Michael Gilfix <[EMAIL PROTECTED]> writes:
> I'd like to build an application that uses pygtk to display
> graphs. However, I'm having some problems using xoring to display
> lines. It doesn't seem to display anything at all (whereas a regular
> gc does). As you can imagine, it's very difficult to build an
> application where you can't toggle dislpays without xor :)
>
> To draw a line with xor, I use the following code:
>
> # self is an object derived from gtk.GtkDrawingArea
> self.colormap = self.get_colormap ()
> win = self.get_window ()
> self.xor_gc = win.new_gc (foreground=self.colormap.alloc ('black'),
>function=GDK.XOR, line_width=3)
When drawing with XOR, the only thing that matters of the color is the
bit pattern of the number actually used as the color. On a TrueType
visual black is most likely all zero which means that nothing will be
changed when drawing with it.
So, to draw with XOR you need to use a color with all 1 bits.
Unfortunately, IIRC, there isn't way to do that in PyGTK. At least there
wasn't when I started porting Sketch to GTK and I wrote a C-function for
that.
> Also, is it safe to rely on pygtk drawing primitives? Since they
> aren't documented, perhaps they're not very stable/reliable?
They seem to work fine in Sketch.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk