Re: [pygtk] How to set pixmap-transparency?
When you create your pixmap, use the color value of None where ever you want the transparency. In your code call pixmap, mask = gtk.create_pixmap_from_xpm(...) Then use that combination when setting the pixmap for a widget, drawing with it, etc. I think you're not getting my point here. I'm creating a pixmap with: pixmap=create_pixmap(widget,width,height,-1) then I create my mask with: mask=create_pixmap(widget,width,height,1) I then draw the text in the colours I want (these are parsed on runtime) with: first: draw_rectangle(mask,widget.get_style().black_gc,TRUE,0,0,width,height) and then draw_text(mask,font,widget.get_style().white_gc,2,14,string) And then the same for the pixmap only with the prober colours. I'm not loading anything. So, does anyone know how to go about getting transparency? Fingers crossed.. ;) (and not anywere near as pissed as I may sound, actually quite jolly... sorta) Christian Storgaard / Cybolic - [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How to set pixmap-transparency?
Christian Storgaard wrote: Hi all. I'm trying to implement colour-formatted CList-items, by creating a pixmap and placing the coloured text on it. This works fine, but if it is to be used proberbly in a CList, the background colour should change when selected, this I know would be relatively simple by just making two pixmaps, but I change the style of the rows dynamically and this would sum up in quite a lot of pixmaps (2 for each style). So, my solution would have to be to make the pixmap transparent, but when I make a pixmap with depth 1 (which is supposed to be a GdkBitmap, used for masks), and use it in the GtkPixmap call like this: pixm=GtkPixmap(pixmap,mask) I get this error: Gdk-ERROR **: BadMatch (invalid parameter attributes) serial 251 error_code 8 request_code 70 minor_code 0 The pixmap must be of the same depth as the visual you are drawing into (almost always the same depth your X server runs at). I even get it if I change the GtkPixmap mask call to None, and so, don't even use the mask. Can anyone tell me what's going on? Or maybe come up with another way to implement colour-formatting in CList (styling (weight,slant) is something I'm trying to do too, btw.) ANY help is much appreciated. If you want transparency, you simply need to set up a mask bitmap. Parts of the mask bitmap with pixel value 0 (black) are transparent, and parts with value 1 (white) are opaque. James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How to set pixmap-transparency?
On Sat, 05 Jan 2002 16:55:43 +0800 James Henstridge (James Henstridge [EMAIL PROTECTED]) wrote: The pixmap must be of the same depth as the visual you are drawing into (almost always the same depth your X server runs at). The pixmap -i'm using is made with depth set to -1, this should work right? I previously made the mask with depth 1, now I tried with -1, still doesn't work. It exits with: Gdk-ERROR **: BadMatch (invalid parameter attributes) serial 646 error_code 8 request_code 56 minor_code 0 If you want transparency, you simply need to set up a mask bitmap. Parts of the mask bitmap with pixel value 0 (black) are transparent, and parts with value 1 (white) are opaque. What do you mean by pixel value? And what is the correct way to make a bitmap (ie. not a pixmap). Up until now I've tried making the mask by drawing the excact same graphics on it as on the pixmap, only using black and white. This doesn't work. Im a bit confused here ;) Christian Storgaard / Cybolic - [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How to set pixmap-transparency?
Follow up: I just tried making the mask with depth set to 1, now there IS transparency (and no crashing), but the transparency seems VERY random (read: corrupted). What am I doing wrong? Christian Storgaard / Cybolic - [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] How to set pixmap-transparency?
Hi all. I'm trying to implement colour-formatted CList-items, by creating a pixmap and placing the coloured text on it. This works fine, but if it is to be used proberbly in a CList, the background colour should change when selected, this I know would be relatively simple by just making two pixmaps, but I change the style of the rows dynamically and this would sum up in quite a lot of pixmaps (2 for each style). So, my solution would have to be to make the pixmap transparent, but when I make a pixmap with depth 1 (which is supposed to be a GdkBitmap, used for masks), and use it in the GtkPixmap call like this: pixm=GtkPixmap(pixmap,mask) I get this error: Gdk-ERROR **: BadMatch (invalid parameter attributes) serial 251 error_code 8 request_code 70 minor_code 0 I even get it if I change the GtkPixmap mask call to None, and so, don't even use the mask. Can anyone tell me what's going on? Or maybe come up with another way to implement colour-formatting in CList (styling (weight,slant) is something I'm trying to do too, btw.) ANY help is much appreciated. Thanks Christian Storgaard / Cybolic - [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk