wxPython is a Python library for creating GUI applications.  This post describes how to install wxPython with Vizard. It also includes a sample script showing how to embed the Vizard graphics window inside a wxPython application.


  • Go to the wxPython download page
  • Download the win32-ansi version of the installer for the version of Python used by Vizard.  Use the table below to determine which version of Python your Vizard installation uses:
    • Vizard 2.x uses Python 2.3
    • Vizard 3.x uses Python 2.4
    • Vizard 4.x uses Python 2.7
    • Vizard 5.x uses Python 2.7
  • Run the installer. It should automatically detect Vizard's Python installation. If you have multiple Python installations on your computer, make sure you select the Vizard Python installation.
  • [Optional] It is recommended to download and install the win32-docs-demos installer (found on the same page). This will install documentation and example code for using wxPython.

You should now be able to use the wxPython library within Vizard. Browse through the website or the sample scripts to learn how to use the module.

Once you have some experience using wxPython you can start embedding your Vizard scripts into a wxPython GUI application.  The biggest difference between a standard Vizard script and an embedded Vizard script is that you must manually control the Vizard mainloop within the embedded version.

The sample script below shows how to embedd the Vizard graphics window within a wxPython application.  The key differences are noted with the IMPORTANT comments.

import wx
import viz

class VizardFrame(wx.Frame):
    """A simple frame that hosts the Vizard graphics window"""
    def __init__(self, parent):
        wx.Frame.__init__(  self,
                            "Vizard Embedded Example",
                            style=wx.DEFAULT_FRAME_STYLE )
        #Create a window to render Vizard 3D graphics
        window = wx.Window(self,-1)
            You must pass the viz.EMBEDDED flag when embedding
            the graphics loop within the script.
            You must also pass the raw window handle when
            embedding the graphics window within an existing window.
        #Add a simple rotating quad
        quad = viz.addTexQuad( pos=(0,1.6,5) )
            You must setup a timer to update the Vizard graphics loop
            at a fast enough rate. (10 milliseconds in this example)
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
    def OnTimer(self, event):
        """Update the Vizard graphics loop whenever the window timer expires"""
        #Destroy window if Vizard graphics loop has ended
        if viz.done():
        #Manually update the graphics loop

if __name__ == '__main__':
    #Setup a simple wxPython app and start the mainloop
    app = wx.PySimpleApp()
    frame = VizardFrame(None)