To Whom It May Concern:

I'm trying to get Python 2.6.5 and wxPython Unicode to work with py2exe 0.6.9. I've encountered a problem and have built a small application to demonstrate the odd behavior. I'll post both the script source and the script below.

import wx

class SimpleSplash(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Info",
                         size = (150, 30))
        st = wx.StaticText(self, -1, "Loading...", (5,5), size = (200,-1), style = wx.ALIGN_CENTER|wx.ST_NO_AUTORESIZE) = st
        sizer = wx.BoxSizer(wx.VERTICAL)
        buttonOne = wx.Button(self,-1,'Test')
    def UpdateTextStatus(self, msg):

class SimpleApp(wx.App):
    def OnInit(self):
        splash = SimpleSplash(None)
        self.splash = splash
        return True  

if __name__ == "__main__":
    app = SimpleApp(redirect = False)
    app.splash.UpdateTextStatus('Hello World!!')

from distutils.core import setup
import py2exe

excludes =  [
                "_imagingtk", "PIL._imagingtk",
                "ImageTk", "PIL.ImageTk", "FixTk", "kinterbasdb", 
                "MySQLdb", 'Numeric', 'OpenGL.GL', 'OpenGL.GLUT',
                'dbGadfly', 'email.Generator', 
                'email.Iterators', 'email.Utils', 'kinterbasdb', 
                'numarray', 'pymssql', 'pysqlite2', 'wx.BitmapFromImage',

windows =   [
                    "script": "",
options =   {
                "optimize": 0, # Displays properly
                #"optimize": 1, # Causing in appropriate GUI controls to display
                #"optimize": 2, # Causing in appropriate GUI controls to display
                "bundle_files": 1,
                "excludes": excludes,

      options = {"py2exe": options},
      windows = windows,

The issue comes from lines 21, 22, 23 of When you use optimization:0, the windows are drawn properly with the XP theme and the buttons are drawn accordingly. When you use optimization:1 or optimization:2, the windows are drawn properly with the XP theme but the buttons are drawn as squarish, NT-like buttons.

I've found this to be the case when calling "python py2exe", "python -O py2exe", and "python -OO py2exe". When I call "python -OO" the windows and buttons are correctly drawn. It appears that there is some inconsistency in the Py2Exe tool chain that is causing this problem.

Is this a know issue? Is there a work around? Where would I look for further documentation on this issue?

Any illumination that can be shared would be greatly appreciated.

Kyle Owens
Decagon Devices, Inc.