A widget displaying an image
Class GtkImage( [filename] )
filename | a filename (string) |
The GtkImage widget displays an image. Various kinds of object can be displayed as an image; most typically, you would load a GdkPixbuf ("pixel buffer") from a file, and then display that.
[...]
GtkImage is a subclass of GtkMisc, which implies that you can align it (center, left, right) and add padding to it, using GtkMisc methods.
GtkImage is a "no window" widget (has no GdkWindow of its own), so by default does not receive events. If you want to receive events on the image, such as button clicks, place the image inside a GtkEventBox, then connect to the event signals on the event box.
Methods | |
clear | Resets the image to be empty. |
new_from_stock | Creates a GtkImage displaying a stock icon. |
set_from_file | Sets the image from a file. |
set_from_stock | Sets an image from stock. |
Resets the image to be empty.
GtkImage.clear()
Creates a GtkImage displaying a stock icon.
GtkImage.new_from_stock( stock_id, size )
stock_id | a stock icon name (string) |
size | (GtkIconSize) |
Return | a new GtkImage displaying the stock icon |
Sample stock icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. Sample stock sizes are GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock icon name isn't known, the image will be empty. You can register your own stock icon names, see gtk_icon_factory_add_default() and gtk_icon_factory_add().
Sets the image from a file.
GtkImage.set_from_file( a )
a | filename or nil |
Sets an image from stock.
GtkImage.set_from_stock( stock_id, size )
stock_id | a stock icon name (string) |
size | (GtkIconSize) |