On Wed, Mar 21, 2001 at 08:33:11AM -0000, satish  k wrote:
> Hi.
> i have a problem with setting the style of widget.
> i want to set the bg style of the widget using bg_pixmap.
> 
> My code is some thing like this.
> 
>       win=GtkWindow()
>       style=win.get_style ().copy ()
>         img = GdkImlib.Image("test.png") 
>         img.render()
>       pix = img.make_pixmap ()

img.make_pixmap() returns a GtkPixmap and you need a GdkPixmap.
You can get the GdkPixmap from the GtkPixmap:

gtkpixmap = img.make_pixmap ()
gdkpixmap, mask = gtkpixmap.get ()
style.bg_pixmap[STATE_NORMAL] = gdkpixmap

The only problem is that pygtk (0.6.3) dumps core ;)

** ERROR **: file gtkmodule.c: line 512 (PyGtkStyleHelper_SetItem): should not be 
reached
aborting...
Aborted (core dumped)

I think newer versions of pygtk fix this.

>         style.bg_pixmap[STATE_NORMAL]=pix
>       win.set_style(style)     
>       win.show_all()
> 
> I get the following error :
>  style.bg_pixmap[STATE_NORMAL]=pix
> TypeError: can only assign a GdkPixmap or None       
> 
> is pix not of type GdkPixmap? if so how to solve this problem?
> 
> Ieven tried this
>       win=GtkWindow()
>       style=win.get_style ().copy ()
>         style.bg_pixmap[STATE_NORMAL]="test.xpm"
>       win.set_style(style)     
>       win.show_all()
>       
> But got the same error.
> someone please help me.
> 
> Thanks for any help.
> regards
> Priya
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to