John Salerno wrote: > I was reading in the wxPython wiki that most of the time you don't have > to include the id parameter at all, and you can just use keyword > arguments for other parameters. But I'm having trouble converting this > code into that method (i.e., without the id parameter).... > > import wx > > class InputForm(wx.Frame): > def __init__(self, parent, id, title): > wx.Frame.__init__(self, parent, id, title) > panel = wx.Panel(self) > self.btnOK = wx.Button(panel, label='OK') > self.btnCancel = wx.Button(panel, label='Cancel') > sizer = wx.BoxSizer(wx.HORIZONTAL) > sizer.Add(self.btnOK, 0, wx.ALL, 10) > sizer.Add(self.btnCancel, 0, wx.ALL, 10) > panel.SetSizer(sizer) > > class MyApp(wx.App): > def OnInit(self): > frame = InputForm(None, -1, title='Data Entry Form') > self.SetTopWindow(frame) > frame.Show() > return True > > app = MyApp(redirect=False) > app.MainLoop()
import wx __version__ = '0.0' class InputForm(wx.Frame): def __init__(self, parent=None, id=-1, title=__file__): # or, if you prefer: ..., id=wx.ID_ANY, ... wx.Frame.__init__(self, parent=parent, id=id, title='%s v%s' % (title, __version__)) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.HORIZONTAL) panel.SetSizer(sizer) sizer.Add(wx.Button(panel, label='OK'), 0, wx.ALL, 10) sizer.Add(wx.Button(panel, label='Cancel'), 0, wx.ALL, 10) class MyApp(wx.App): def OnInit(self): frame = InputForm(title='Data Entry Form') self.SetTopWindow(frame) frame.Show() return True if __name__ == '__main__': MyApp(redirect=False).MainLoop() --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list