To Whom It May Concern:

I'm trying to get Python 2.6.5 and wxPython 2.8.10.1 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 setup.py script below.

**********SimpleApp.py**********
import wx

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

class SimpleApp(wx.App):
    def OnInit(self):
        splash = SimpleSplash(None)
        splash.Show(True)
        self.SetTopWindow(splash)
        self.splash = splash
        splash.UpdateTextStatus("loading...")
        return True  

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

**********setup.py**********
from distutils.core import setup
import py2exe

excludes =  [
                "Tkconstants","Tkinter","tcl", 
                "_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": "SimpleApp.py",
                }
            ]
            
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,
            }

setup(name="SimpleApp",
      scripts=["SimpleApp.py"],
      console=['SimpleApp.py'],
      options = {"py2exe": options},
      windows = windows,
     )

The issue comes from lines 21, 22, 23 of setup.py. 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 setup.py py2exe", "python -O setup.py py2exe", and "python -OO setup.py py2exe". When I call "python -OO SimpleApp.py" 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.

Sincerely,
Kyle Owens
kyle@decagon.com
Decagon Devices, Inc.