Re: Changing pixmaps on-the-fly



Kristopher Kycia wrote:

> Hello all,
>
> I was wondering if anybody had ideas about how to dynamically change
> pixmaps on-the-fly.  I have a button on which I have a pixmap and I
> would like to change the pixmap each time you click on the button.  BTW
> my button is packed with a HBox containing 3 columns:  A label, the
> pixmap and another label.
>
> I'm not too sure how to do this because I am using Glade as a GUI
> builder.  If I was to code this up, I guess it would definetely be
> easier.  Unfortunatly then the design of the windows would take much
> more time.  Anybody have any ideas?
>
> Kristopher Kycia
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list

A quite "ugly" way of doing what you want. It worked for my in the past.

Suppose you have n-different pixmaps to cycle. Then where you are
currently putting your pixmap, put in its place an hbox, and then pack
all
of your pixmaps in this hbox. Then hide all of the pixmaps (but not the
hbox, of course) (with gtk_widget_show, gtk_widget_hide, etc...), and
only
show the first pixmap.
Connect the clicked signal of the button with a signal handler in which,
you hide the last pixmap, and then show the next one (again
gtk_widget_show, gtk_widget_hide).
Even you can make an animation with a gtk_timer_add (or
gtk_iddle_add)...
Hope it helps....





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]