Gtk-WARNING: Unable to locate theme engine in module_path: "wimp"
Question: I developed an Gtk Application that works on Windows. I use pyInstaller to
build one exe file. Everything would be OK if not for the theme that not
loads.

**So, I have my spec file:**

    
    
    # -*- mode: python -*-
    
    directory = 'C:\\my_project'
    
    a = Analysis(['main.py'],
                 pathex=[directory],
                 hiddenimports=None,
                 hookspath=None)
    
    
    more_datas = []
    more_binaries = []
    
    more_datas.append(('gtkrc', os.path.join(directory, 'gtkrc'), 'DATA'))
    more_binaries.append(('libwimp.dll', os.path.join(directory, 'libwimp.dll'), 'BINARY'))
    
    pyz = PYZ(a.pure)
    
    exe = EXE(pyz,
              a.scripts,
              a.binaries + more_binaries,
              a.zipfiles,
              a.datas + more_datas,
              name='main.exe',
              debug=False,
              strip=None,
              upx=True,
              console=True)
    

In the DATA section, I include the gtkrc file And in BINARIES section, I
include the libwimp.dll. Both files are in my application directory.

**In my project python code, I have:**

    
    
    def resource_path(relative):
        directory = getattr(sys, '_MEIPASS', os.getcwd())
        return os.path.join(directory, relative)
    
    
    theme = resource_path("gtkrc")
    gtk.rc_set_default_files([theme])
    gtk.rc_reparse_all_for_settings(gtk.settings_get_default(), True)
    gtk.rc_reset_styles(gtk.settings_get_for_screen(window.get_screen()))
    

When I run application, a temporary directory is created ("_MEIXXXXXX") and
the two files are included there.

**But the console shows the message:**

> Gtk-WARNING: Unable to locate theme engine in module_path: "wimp"

And the theme not load. This Warning appears after this code bellow is called:

    
    
    gtk.rc_reparse_all_for_settings(gtk.settings_get_default(), True)
    

What I'm missing?


Answer: I found where I was going wrong.

The problem was that I copied the theme to the local directory of my
application. The libwimp.dll file must be created within a specific directory
to work in the temporary folder.

This tip helped me solve:

[Add hooks for PyGTK themes](http://www.pyinstaller.org/ticket/14)

