Hello, I have a python Gtk+ 3 (GObject) program.
Once compiled with pyinstaller (the git HEAD) on linux and get the
following error messages and no icons appear:
(iconwindow:26914): Gtk-WARNING **: Error loading theme icon
'image-missing' for stock: Unrecognized image file format
(iconwindow:26914): Gdk-CRITICAL **: gdk_cairo_surface_create_from_pixbuf:
assertion 'GDK_IS_PIXBUF (pixbuf)' failed
I assume I need to add a path to "datas" in the spec file?
If so, could someone tell me the path I need to add?
Thanks for the help.
A boiled down version of the program is below.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
class DotWindow(Gtk.Window):
"""
The main window.
"""
toolbar_spec = '''
<ui>
<toolbar name="ToolBar">
<toolitem action="Save"/>
<toolitem action="Print"/>
<separator/>
<toolitem action="ZoomIn"/>
<toolitem action="ZoomOut"/>
<toolitem action="ZoomFit"/>
<toolitem action="ZoomFirst"/>
<separator/>
<toolitem name="Back" action="Back"/>
</toolbar>
</ui>
'''
def __init__(self):
GObject.GObject.__init__(self)
self.set_title('The Window')
self.vbox = Gtk.VBox()
self.add(self.vbox)
# Create a UIManager instance
uimanager = self.uimanager = Gtk.UIManager()
# Create an ActionGroup
actiongroup = Gtk.ActionGroup('Actions')
self.actiongroup = actiongroup
# Create actions
actionlist = [
('Save', Gtk.STOCK_FLOPPY, 'Save', None,
"Save the graph [ctrl-s]", helloWorld),
('Print', Gtk.STOCK_PRINT, 'Print', None,
"Print visible part of graph [p]", helloWorld),
('ZoomIn', Gtk.STOCK_ZOOM_IN, 'Zoom In', None,
"Zoom in [+]", helloWorld),
('ZoomOut', Gtk.STOCK_ZOOM_OUT, 'Zoom Out', None,
"Zoom out [-]", helloWorld),
('ZoomFit', Gtk.STOCK_ZOOM_FIT, 'Zoom Fit', None,
"Fit to window [w]", helloWorld),
('ZoomFirst', Gtk.STOCK_HOME, 'Zoom First', None,
"Zoom to first vertex [h]", helloWorld),
('Back', Gtk.STOCK_GO_BACK, 'Back', None,
"Go to previous view [Backspace]", helloWorld),
]
actiongroup.add_actions(actionlist)
## Add the actiongroup to the uimanager
uimanager.insert_action_group(actiongroup, 0)
# Add a UI description
uimanager.add_ui_from_string(self.toolbar_spec)
# Create a Toolbar
toolbar = uimanager.get_widget('/ToolBar')
toolbar.set_style(Gtk.ToolbarStyle.ICONS) #TOOLBAR_BOTH, _ICONS,
_TEXT
self.vbox.pack_start(toolbar, False, False, 0)
self.show_all()
def helloWorld(arg):
print('Hello World.')
def main():
window = DotWindow()
window.connect('destroy', Gtk.main_quit)
Gtk.main()
if __name__ == "__main__":
main()
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.