Hi, all. I'm working on a program which is going to be using a lot of icons. To make things a bit easier, I'm creating a dictionary of name/icon pairs.
This works nicely for disk-loaded images, but I just tried to add in
some stock icons, and I'm getting a confusing error.
Here's my function:
---------------
def load_images(self):
file_icons = \
{'host':'host.png','dis-host':'host_disconnected.png',
'net':'network.png', 'table':'tables.png',
'view':'views.png', 'database':'database.png',
'schema':'schema.png',
'dis-database':'database_disconnected.png'}
stock_icons = {'procedure': gtk.STOCK_EXECUTE }
for icon in file_icons.keys():
image = gtk.Image()
image.set_from_file('icons/%s' % file_icons[icon])
self.icons[icon] = image
for icon in stock_icons.keys():
image = gtk.Image()
image.set_from_stock(stock_icons[icon],
gtk.ICON_SIZE_MENU)
self.icons[icon] = image
----------------
As I said - the part loading from file_icons works fine. But when I try
to use the stock icon, I get this:
Traceback (most recent call last):
File "./browser.py", line 391, in connect_to_host
self.build_schema_tree(iter, con)
File "./browser.py", line 322, in build_schema_tree
self.icons['procedure'].get_pixbuf())
ValueError: image should be a GdkPixbuf or empty
This call works for the disk loaded icons. What am I doing wrong for the
stock icons?
TIA,
cf
--
Colin Fox <[EMAIL PROTECTED]>
CF Consulting Inc.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
