Development Team/Almanac/sugar.graphics.icon
< Development Team | Almanac
Class: Icon
How do I create a button with a specific icon image?
You must first create the appropriately sized Icon object, as shown below. Then you will use the set_image() method to assign the icon to the button.
import pygtk pygtk.require('2.0') import gtk from sugar.graphics.icon import Icon ... #previous page button prev_page_button = gtk.Button() prev_page_icon = Icon(icon_name='prev-page', icon_size=gtk.ICON_SIZE_BUTTON) prev_page_button.set_image(prev_page_icon)