On Fri, 19 May 2000 [EMAIL PROTECTED] wrote:
> [Python 1.6a2, pygtk-0.7.0, gtk+1.2.7, Suse Linux 6.1(2.2.11), pentium]
>
> How does one simply get a color object to set the background of a widget?
> I.e.:
>
> from _gtk import *
> from GTK import *
why are you importing these modules directly? Just use "import gtk" or
"from gtk import *".
> w = GtkWindow(WINDOW_TOPLEVEL)
> clist = GtkCList(1, ('name'))
> clist.append(['George Young'])
> w.add(clist)
> w.showall()
> cm = w.get_colormap()
> blue_color = cm.alloc((10, 10, 200)) #segmentation fault
the extra brackets are incorrect here.
> blue_color = cm.alloc('blue') #segmentation fault
I find it hard to believe that this caused a seg fault. Do you just mean
an exception? I was getting an exception here because of a weird
interaction with ExtensionClass. I have fixed it in CVS now. The fix is
to edit gtk-types.c and insert the following line below the include
statements:
#undef Py_FindMethod
That should fix the problem (after recompiling).
>
> !! how do I get a GtkColor that is, e.g., 'blue'? I would rather use names
> than rgb values, but anything would be helpful.
When passing a string argument, you can use any colour name in
/usr/lib/X11/rgb.txt, or hex forms like '#rrggbb' or 'rgb:rr/gg/bb'.
>
> clist.set_background(blue_color)
>
>
> Thanks,
> George
>
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]