Changes
Development Team/Almanac/sugar.graphics.icon (view source)
Revision as of 11:04, 10 July 2008
, 11:04, 10 July 2008→Class: Icon
= Class: Icon =
= 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 [http://www.pygtk.org/docs/pygtk/class-gtkbutton.html#method-gtkbutton--set-image set_image()] method to assign the icon to the button.
<pre>
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)
</pre>
= Class: CanvasIcon =
= Class: CanvasIcon =