Why can't I run this code?

I get the following error:
AttributeError: 'OrderSearch' object has no attribute 'id'
File "C:\Documents and Settings\mgenti\Desktop\untitled-2.py", line
73, in <module>
  MainWindow(None, -1)
File "C:\Documents and Settings\mgenti\Desktop\untitled-2.py", line
10, in __init__
  dlg = OrderSearch(self, -1)
File "C:\Documents and Settings\mgenti\Desktop\untitled-2.py", line
61, in __init__
  items = [self.id, self.idTC, self.idCheck, self.statusST,
self.statusCB, self.statusCheck,

If you remove self.id from the list the frame is displayed

···

On Thu, May 8, 2008 at 3:51 PM, David Anderson <zerty.david@gmail.com> wrote:

I'm trying to run this code, but it compiles, runs, and then appears
something very fast that I can't read =(
Can anyone help? Here is the entire app code =)

import wx

class MainWindow(wx.Frame):
    #Construtor
    def __init__(self, parent, id, title = "Test"):
        wx.Frame.__init__(self, parent, id, title, size = (1024,740),style =
wx.CLOSE_BOX |
                           wx.CAPTION |
wx.RESIZE_BORDER|wx.SYSTEM_MENU|wx.MINIMIZE_BOX|wx.CLOSE_BOX)
        menubar = wx.MenuBar()
        self.SetMenuBar(menubar)
        dlg = OrderSearch(self, -1)
        dlg.ShowModal()
        self.Centre()
        self.Fit()
        self.SetMinSize(self.GetSize())
        self.Show(True)

class OrderSearch(wx.Dialog):
    def __init__(self, parent, id):
        wx.Dialog.__init__(self, parent, id)
        #labels
        self.idST = wx.StaticText(self, -1, "ID", style = wx.ALIGN_LEFT)
        self.statusST = wx.StaticText(self, -1, "Status", style =
wx.ALIGN_LEFT)
        self.typeST = wx.StaticText(self, -1, "Type", style = wx.ALIGN_LEFT)
        self.id2ST = wx.StaticText(self, -1, "ID", style = wx.ALIGN_LEFT)
        self.galleryST = wx.StaticText(self, -1, "Gallery", style =
wx.ALIGN_LEFT)
        self.dateRangeST = wx.StaticText(self, -1, "Date Range", style =
wx.ALIGN_LEFT)

        #Fields
        self.idTC = wx.TextCtrl(self, -1)
        statusList = ['Status', 'to', 'be', 'chosen']
        self.statusCB = wx.ComboBox(self, 500, "Choose from below", (90,
50),
                         (160, -1), statusList,
                         wx.CB_DROPDOWN)
        typeList = ['Types', 'to', 'be', 'chosen']
        self.typeCB = wx.ComboBox(self, 500, "Choose from below", (90, 50),
                         (160, -1), typeList,
                         wx.CB_DROPDOWN)
        self.id2TC = wx.TextCtrl(self, -1)
        galleryList = ['Gallery', 'stuff', 'will', 'be', 'ordered']
        galleryList.sort()
        self.galleryCB = wx.ComboBox(self, 500, "Choose from below", (90,
50),
                         (160, -1), galleryList,
                         wx.CB_DROPDOWN)
        self.initialDateRange = wx.DatePickerCtrl(self, size=(120,-1),
                                style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY)
        self.finalDateRange = wx.DatePickerCtrl(self, size=(120,-1),
                                style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY)
        #Checkboxes
        self.idCheck = wx.CheckBox(self,-1)
        self.statusCheck= wx.CheckBox(self,-1)
        self.typeCheck = wx.CheckBox(self,-1)
        self.id2Check = wx.CheckBox(self,-1)
        self.galleryCheck = wx.CheckBox(self,-1)
        self.dateRangeCheck = wx.CheckBox(self,-1)

        #Buttons
        self.searchB = wx.Button(self, wx.ID_ANY, "Search")

        #Sizers
        self.fgs = wx.FlexGridSizer(8,3,4,4)
        items = [self.id, self.idTC, self.idCheck, self.statusST,
self.statusCB, self.statusCheck,
                 self.typeST, self.typeCB, self.typeCheck, self.id2ST,
self.id2TC, self.id2Check,
                 self.galleryST, self.galleryCB, self.galleryCheck,
self.dateRangeST,
                 self.initialDateRange, self.dateRangeCheck,
wx.StaticText(self, -1, ""),
                 self.finalDateRange, wx.StaticText(self, -1, ""),
wx.StaticText(self, -1, ""),
                 self.searchB, wx.StaticText(self, -1, "")]
        self.fgs.AddMany(items)
        self.SetSizer(self.fgs)
        self.Show(True)

app = wx.App()
MainWindow(None, -1)
app.MainLoop()

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users