Before anyone else wastes any time pondering this one, I should let you
know I already discovered what I was doing wrong.

My problem was not in the code at all, it was in the glade project file.
I was looking at the xml when I realised that I had another window
defined in the project (initially hidden) that had a pixmap widget with
the same name. When creating these windows from code there is no name
clash because the two pixmap widgets have different parent windows, but
it hadn't occurred to me that because of the manner of getting libglade
references via a string representing the individual widget name only
(eg. widgets.get_widget('widget-name')), the glade project file becomes
in effect a single "widget namespace".

The solution I guess (not that I expect anyone else to be silly enough
to make this mistake) is to either adopt a naming convention for your
glade widgets that differntiates between child widgets that perform the
same function on different parent windows , (which is what I did to
solve my problem), or to always define different parent windows
belonging to the same program in different glade projects.

Ciao,
Stephen.

> From: Stephen <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [pygtk] changing a GtkPimap in a liblglade app...??
> 
> Hi James et al...
> 
> I have a ui I have built both manually and using libglade. I have a
> pixmap that I need to change the appearance of while the app is running.
> When I do this kind of thing in the manually built version:
> 
> ------
> class Pixmap1(gtk.GtkPixmap):
>   def __init__(self,pixmapData):
>     pix,
> msk=gtk.create_pixmap_from_xpm_d(gtk.GtkWindow(),None,pixmapData)
>     gtk.GtkPixmap.__init__(self,pix,msk)
> pixmap1=Pixmap1(initialPixmapData)
> pixmap1.show()
> #etc., we have pixmap1 displaying fine
> #then later on...
> pix, msk = gtk.create_pixmap_from_xpm_d(gtk.GtkWindow(),None,
>                                         newPixmapData)
> pixmap1.set(pix,msk)
> ------
> 
> It works exactly as I'd expect, that is, the appearance of pixmap1
> changes to reflect the new pixmap data.
> 
> But when I do this kind of thing in the libglade version:
> 
> ------
> widgets = libglade.GladeXML('app.glade')
> pixmap1 = widgets.get_widget('pixmap1')
> #etc., we have pixmap1 displaying fine
> #then later on...
> pix, msk = gtk.create_pixmap_from_xpm_d(gtk.GtkWindow(),None,
>                                         newPixmapData)
> pixmap1.set(pix,msk)
> ------
> 
> The appearance of pixmap1 does not change. Why? How do I acheive my
> desired result in the libglade version?
> 
> TIA for any replies,
> regards,
> Stephen.

--
<[EMAIL PROTECTED]>
More power to those who don't care for it.


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

Reply via email to