Windows get rendered differently if run the application using python or the
Mac OS X app generated using py2app.  Here are versions of tools I am using.
python: 2.5.1
wxpython: 2.8.0
py2app: 0.3.6

I run py2applet AutoCorrDlg.py to generate the app.

Any ideas when this is happening?  Thanks.

Here is the AutoCorrDlg.py code
import wx

ID_AUTOCORRDLG_ON_NEW_REPLACE       = wx.NewId()
ID_AUTOCORRDLG_ON_DELETE            = wx.NewId()

class AutoCorrDlg(wx.Dialog):
    def __init__(
            self, parent, ID, title='AutoCorr',
            size=(500, 500), pos=wx.DefaultPosition,
            style=wx.DEFAULT_DIALOG_STYLE):
        # Instead of calling wx.Dialog.__init__ we precreate the dialog
        # so we can set an extra style that must be set before
        # creation, and then we create the GUI dialog using the Create
        # method.
        #pre = wx.PreDialog()
        #pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        #pre.Create(parent, ID, title, pos, size, style)

        # This next step is the most important, it turns this Python
        # object into the real wrapper of the dialog (instead of pre)
        # as far as the wxPython extension is concerned.
        #self.PostCreate(pre)
        wx.Dialog.__init__(self, id=ID, name=u'AutoCorrDlg',
              parent=parent, size=size, style=style, title=title)

        # Now continue with the normal construction of the dialog
        # contents
        self.init_ctrls(parent)

        self.InitFindReplaceUI()

    def init_ctrls(self, parent):
        self.ReplaceLabel = wx.StaticText(self, -1, 'Replace')
        self.WithLabel = wx.StaticText(self, -1, 'With')
        self.ReplaceTextCtrl = wx.TextCtrl(self, -1)
        self.WithTextCtrl = wx.TextCtrl(self, -1)
        self.NewReplaceButton = wx.Button(self,
ID_AUTOCORRDLG_ON_NEW_REPLACE, 'New')
        self.ReplaceWithListCtrl = wx.ListCtrl(self, -1, size=(100, 350),
style=
                wx.LC_REPORT |
                wx.LC_NO_HEADER |
                wx.LC_SINGLE_SEL |
                wx.BORDER_SUNKEN)
        self.DeleteButton = wx.Button(self, ID_AUTOCORRDLG_ON_DELETE,
'Delete')
        self.EnableCheckBox = wx.CheckBox(self, -1, 'Enable Autocorrect')

        # Disable buttons
        self.NewReplaceButton.Disable()
        self.DeleteButton.Disable()

        # resize of the windows
        if wx.Platform == '__WXGTK__':
            # Initiize size of TextCtrl under gtk is not very nice so resize
lets resize them
            size = self.WithTextCtrl.GetSize()
            size[0] = 120
            self.ReplaceTextCtrl.SetInitialSize(size)
            size[0] = 250
            self.WithTextCtrl.SetInitialSize(size)
        else:
            size = self.WithTextCtrl.GetSize()
            size[0] *= 2.5
            self.WithTextCtrl.SetInitialSize(size)

        gbs = wx.GridBagSizer(5,3)

        row = 0
        gbs.Add(self.ReplaceLabel, (row,0), wx.DefaultSpan, wx.TOP |
wx.LEFT, 10)
        gbs.Add(self.WithLabel, (row,1), wx.DefaultSpan, wx.TOP | wx.LEFT,
10)
        row += 1
        gbs.Add(self.ReplaceTextCtrl, (row, 0), wx.DefaultSpan, wx.TOP |
wx.LEFT, 10)
        gbs.Add(self.WithTextCtrl, (row, 1), wx.DefaultSpan, wx.TOP |
wx.LEFT, 10)
        gbs.Add(self.NewReplaceButton, (row, 2), wx.DefaultSpan, wx.TOP |
wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 10)
        row += 1
        gbs.Add(self.ReplaceWithListCtrl, (row,0), (1,2), wx.TOP | wx.LEFT |
wx.EXPAND, 10)
        gbs.Add(self.DeleteButton, (row, 2), wx.DefaultSpan, wx.TOP |
wx.LEFT | wx. RIGHT | wx.ALIGN_CENTER, 10)
        row += 1
        gbs.Add(self.EnableCheckBox, (row, 0), (1,2), wx.TOP | wx.LEFT, 10)
        row += 1

        self.OkButton = wx.Button(self, wx.ID_OK)
        self.OkButton.SetDefault()

        btnsizer = wx.StdDialogButtonSizer()

        btnsizer.Add(self.OkButton)
        btnsizer.Realize()

        gbs.Add(btnsizer, (row, 0), (1, 3), wx.ALIGN_RIGHT | wx.ALL, 10)

        self.SetSizer(gbs)
        self.Fit()

    def InitFindReplaceUI(self):
        findWidth = self.ReplaceTextCtrl.GetSize()[0]+10

        self.ReplaceWithListCtrl.InsertColumn(0, "Replace", width =
findWidth)
        self.ReplaceWithListCtrl.InsertColumn(1, "With")

app = wx.PySimpleApp()

dlg = AutoCorrDlg(None, -1)
dlg.ShowModal()
dlg.Destroy()

app.MainLoop()
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to