Changes

Line 1: Line 1:  
= 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 =
Anonymous user