ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
Re: [wxpython-users] Why can't I run this code?
by Mark Guagenti other posts by this author
May 8 2008 2:00PM messages near this date
Re: [wxpython-users] Why can't I run this code? | [wxpython-users] CustomTreeCtrl Edit Labels (to Andrea)
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@[...].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@[...].org
>  http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
> 
> 
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
David Anderson
Mark Erbaugh
David Anderson
Mark Erbaugh
Christopher Barker
Mark Guagenti

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved