[pygtk] little icon trouble
Pietro Battiston
toobaz at email.it
Wed Jun 2 21:40:11 WST 2010
Il giorno mer, 02/06/2010 alle 11.28 +0200, Pasquale Boemio ha scritto:
> Hi everybody.
> I'm working at a little python's applet for the gnome-panel,
> but some button icons don't show.
> An example:
> this is the code that show the image
>
> self.PlayButton = gtk.Button()
> self.PlayButtonImage = gtk.Image()
> self.PlayButtonImage.set_from_stock("gtk-media-play",gtk.ICON_SIZE_BUTTON)
> self.PlayButton.set_image(self.PlayButtonImage)
> self.PlayButton.set_relief(gtk.RELIEF_NONE)
> self.PlayButton.connect("clicked",self.myGestour.Play)
> self.ButtonBar.add(self.PlayButton)
>
> this not
> self.PrevButton = gtk.Button()
> self.PrevButtonImage = gtk.Image()
> self.PrevButtonImage.set_from_stock(gtk.STOCK_MEDIA_PREVIOUS,gtk.ICON_SIZE_BUTTON)
> self.PrevButton.set_image(self.PrevButtonImage)
> self.PrevButton.set_relief(gtk.RELIEF_NONE)
> self.PrevButton.connect("clicked",self.myGestour.Prev)
> self.ButtonBar.add(self.PrevButton)
>
> where I wrong?
Don't know, but on my system the following shows both.
import gtk
PrevButton = gtk.Button()
PrevButtonImage = gtk.Image()
PrevButtonImage.set_from_stock(gtk.STOCK_MEDIA_PREVIOUS,gtk.ICON_SIZE_BUTTON)
PrevButton.set_image(PrevButtonImage)
PrevButton.set_relief(gtk.RELIEF_NONE)
PlayButton = gtk.Button()
PlayButtonImage = gtk.Image()
PlayButtonImage.set_from_stock("gtk-media-play",gtk.ICON_SIZE_BUTTON)
PlayButton.set_image(PlayButtonImage)
PlayButton.set_relief(gtk.RELIEF_NONE)
w = gtk.Window()
w.add(gtk.VBox())
w.child.pack_start(PlayButton)
w.child.pack_start(PrevButton)
w.show_all()
gtk.main()
So if it doesn't work for you, I guess the problem is not in the code.
Pietro
More information about the pygtk
mailing list