worksofcraft
August 22nd, 2010, 09:00 AM
./clockgui.py:9: GtkWarning: gtk_image_set_from_icon_name: assertion `GTK_IS_IMAGE (image)' failed
self.wTree.add_from_file("clockgui.glade")
I'm trying to add a volume control to the Glade GUI of my Python speaking clock app. It seems to all be working but it just won't show the icon :(
I get above error message and can't work out how to include the icons. If anyone wants to have a look here is my glade file and a stripped down version of my Python script...
#!/usr/bin/python
import pygtk
import gtk
import gtk.glade
class ClockGUI:
def __init__(self):
self.wTree = gtk.Builder()
self.wTree.add_from_file("clockgui.glade")
self.window = self.wTree.get_object("window1")
# terminate the loop when main window is destroyed
self.window.connect("destroy", gtk.main_quit)
gui = ClockGUI()
gtk.main()
clockgui.glade:
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="visible">True</property>
<child>
<object class="GtkVolumeButton" id="volumebutton1">
<property name="label">gnome-stock-volume</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
<property name="orientation">vertical</property>
<property name="size">large-toolbar</property>
<property name="icons">audio-volume-muted
audio-volume-high
audio-volume-low
audio-volume-medium</property>
</object>
</child>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">59</property>
<property name="step_increment">1</property>
</object>
</interface>
Thanks in advance for any feedback :)
p.s. also thanks for pointing out my typo... the above file was not clock.glade, but clockgui.glade
self.wTree.add_from_file("clockgui.glade")
I'm trying to add a volume control to the Glade GUI of my Python speaking clock app. It seems to all be working but it just won't show the icon :(
I get above error message and can't work out how to include the icons. If anyone wants to have a look here is my glade file and a stripped down version of my Python script...
#!/usr/bin/python
import pygtk
import gtk
import gtk.glade
class ClockGUI:
def __init__(self):
self.wTree = gtk.Builder()
self.wTree.add_from_file("clockgui.glade")
self.window = self.wTree.get_object("window1")
# terminate the loop when main window is destroyed
self.window.connect("destroy", gtk.main_quit)
gui = ClockGUI()
gtk.main()
clockgui.glade:
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="visible">True</property>
<child>
<object class="GtkVolumeButton" id="volumebutton1">
<property name="label">gnome-stock-volume</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
<property name="orientation">vertical</property>
<property name="size">large-toolbar</property>
<property name="icons">audio-volume-muted
audio-volume-high
audio-volume-low
audio-volume-medium</property>
</object>
</child>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">59</property>
<property name="step_increment">1</property>
</object>
</interface>
Thanks in advance for any feedback :)
p.s. also thanks for pointing out my typo... the above file was not clock.glade, but clockgui.glade