[pygtk] Getting font-info
How do I get the X font-info from a GdkFont? In C I should be able to just use get_font_id(), but as far as I can tell, this isn't implemented in PyGTK yet? I want to use to reload a font in italic, if there's another way to do italic fonts, I'll use it ;) P.S. It's not for use on labels but by drawing functions (draw_text()). P.P.S. The answer to my previous questions about masks was: (thanks to John Finlay) A GdkBitmap is a GtkPixmap created with: mask=create_pixmap(None,width,height,1) And it should be drawn upon using only: transparent=mask.new_gc() mask=mask.new_gc() mask.foreground=mask.background Those were the excact answers I was looking for, so I hope they'll ease some other's searching. Thanks anyways to all who answered my many posts about it. .~. ,~, /V\ Christian Storgaard / Cybolic /V\ // \\/ [EMAIL PROTECTED]\// \\ /( ) ( )\ ^`~'^ ^`~'^ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How can one create a new GC ?
On Mon, 7 Jan 2002 19:52:18 +0100 Lionel Ulmer (Lionel Ulmer [EMAIL PROTECTED]) wrote: Hi all, I am planning to write a 'custom widget' in PyGTK (well, mostly using the GtkDrawingArea widget and draw some stuff in it :-) ), but I have a problem : I need to draw things in different colors. Now, how can I create a new GdkGC ? I could take one of the default provided GCs and change the drawing color, but that is not satisfying. So am I completely dumb and missed the API or do I need to modify the standard provided GCs (or copy the default style and modify the GCs of the copied styles and use these) ? Thanks, Lionel PS: I am using GTK+1.2.3 so PyGTK 0.6.x You can create a new GC with the following command: widget.new_gc(foreground=my_own_GdkColor) where widget is any widget that has it's own window (ie. pretty much anything but labels), and the foreground is just one of the many properties of a GC, see the 'description.py' file included with PyGTK. Cheers. 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?
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?
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
[pygtk] Strange window-icon
Hello again all I'm trying to set the window-icon by using: pix, mask = create_pixmap_from_xpm(self, None, icon.xpm) self.set_icon(pix,mask) where self is the window, but instead of the icon I get a bunch of lines and dots in different colours, although sometimes, it looks allright. What's going on? Should I use a different method for setting the icon or what? ANY help is MUCH appreciated. Christian Storgaard / Cybolic - [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Tooltips in CList cells/rows
I am currently writing a CD player using pygtk and want to popup a tooltip over each track in my CList containing the full title of the track if it's not fully visible normally. I know how to do it all except attaching the tooltip to the cell/row. It should be something like: tt.set_tip(clist.get_row_data(track) But get_row_data() returns nothing, so how do I do it? Anyone? ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Styles get overwritten...
I have succesfully changed the bg colour of some buttons in my program by the use of styles. But.. As soon as my beautiful greenish colour has been painted onto the buttons, my default pixmap theme paints it over with it's gradient grey. How do I stop this?! I know I can stop it by choosing a different engine (like notif), but I want to use the default engine... See the prob? Please help ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk