[pygtk] Pb drawing on a pixmap
Elby
loic.berthe at free.fr
Wed Mar 29 00:47:01 WST 2006
Hi,
I'm trying to draw on a pixmap, but all I get is a black window.
It seems I've got a problem with Graphic Context, but I don't understand why.
Here is a simple test :
- I create a gdk.Color
- I create a pixmap and a new Graphic Context with background and foreground color equal to this color :
WIDTH = 200
HEIGHT = 200
color_name = 'navajowhite'
gdk_color = gtk.gdk.color_parse(color_name)
pixmap2 = gtk.gdk.Pixmap(None, WIDTH, HEIGHT, 24)
gc = gtk.gdk.GC(pixmap2,background=gdk_color, foreground=gdk_color)
- when I compare my gdk.Color with gc.foreground and gc.background I get different colors :
print "%8s "*4 % ('pixel', 'red','green','blue')
for x in (gdk_color, gc.background, gc.foreground) :
print "%8d "*4 % (x.pixel, x.red, x.green, x.blue)
pixel red green blue
0 65535 57054 44461
0 19164 47096 20704
0 1 0 0
Why ?
I made a few test with pixmap2.new_gc(...) but I didn't have more success
Can you explain me how to set a graphic context correctly and how to draw on a pixmap ?
Attached is the code I use to test drawing on a pixmap.
Have you any idea to make it work correctly ?
Best regards
-- Elby
-------------- section suivante --------------
Une pi?ce jointe non texte a ?t? nettoy?e...
Nom: Test_Pixmap.py
Type: text/x-python
Taille: 1326 octets
Desc: non disponible
Url: http://www.daa.com.au/pipermail/pygtk/attachments/20060328/38d8eb31/Test_Pixmap.py
More information about the pygtk
mailing list