On Thu, 28 Jun 2001, XzgXr Caner wrote:

>
> I have little problem with a GtkText widget and GdkColor.
> Please look at the code and say if the code is correct or not.
> When I insert a colored text with "GtkText.insert (font, fg, bg, string)" it's only 
>displayed
> as black and white. And I can't figure it out.
>
> --- PYTHON CODE ---
> #!/usr/bin/env python
>
> from gtk import *
> from parser import *
> from keyword import *
>
> text = ''
> token = ''
>
> def process (*args):
>       global text, token, win
>
>       keyword = load_font ('-misc-fixed-bold-r-normal-*-*-120-*-*-c-*-iso8859-1')
>       default = load_font ('-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-1')
>
>     blue = args[0].get_colormap().alloc (0, 0, 255)
                                                 ^^^
Gdk uses 16-bit colour values (like all other X toolkits), so change the
255 to 0xffff, and you should be fine.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to