1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
"""
Icon.py
by Jason Conti
February 22, 2010
Utility functions for working with icons.
"""
import gtk
def load_icon(name, size = 48):
"""Loads an icon from the default icon theme."""
try:
theme = gtk.icon_theme_get_default()
return theme.load_icon(name, size, gtk.ICON_LOOKUP_FORCE_SVG)
except:
return None
def load_icon_from_file(path, size = 48):
"""Loads an icon from the given path."""
try:
return gtk.gdk.pixbuf_new_from_file_at_size(path, size, size)
except:
return None
|