On this page

Overview

This example shows how to use the wxPython UI library to create a custom user interface inside Houdini by invoking wxPython’s event loop from Houdini’s event loop.

Houdini does not include the wxPython library, so if you want to use it you must first install it.

Note

Since Houdini itself is based on the Qt UI library, if possible we recommend you use a Qt user interface library such as [PySide|, or use a python panel, to create custom user interfaces.

Windows

On Windows, make sure to install the library to the Python included with Houdini (in Houdini install location/python).

Implementation

  1. Open $HFS/houdini/help/files/hom_cookbook/wxPython.hip.

    If you haven’t installed wxPython first, you’ll get an error about hou.session not being able to import the wx package.

  2. Choose Windows ▸ Python source editor to see the scene file’s Python module. It defines a simple "font chooser dialog" window class using wx, as well as helper functions to patch the wx event loop and show the window.

  3. Create a shelf tool to run the following code, or just type it into a Python shell (Windows ▸ Python shell):

    showFontDialog()
    

HOM Cookbook