[wxpython-users] Why can't I run this code?

David Anderson zerty.david at gmail.com
Thu May 8 17:03:16 PDT 2008


The thing is, I was trying to put the seld.id, But was supposed to put the
self.idST, probably self.id is an atribute from the class

Thanks for help

On Thu, May 8, 2008 at 7:05 PM, Mark Erbaugh <mark at microenh.com> wrote:

> On Thu, 2008-05-08 at 17:51 -0300, David Anderson wrote:
> > I'm trying to run this code, but it compiles, runs, and then appears
> > something very fast that I can't read =3D(
> > Can anyone help? Here is the entire app code =3D)
> >
> > import wx
> >
> > class MainWindow(wx.Frame):
> >     #Construtor
> >     def __init__(self, parent, id, title =3D "Test"):
> >         wx.Frame.__init__(self, parent, id, title, size =3D
> > (1024,740),style =3D wx.CLOSE_BOX |
> >                            wx.CAPTION | wx.RESIZE_BORDER|
> > wx.SYSTEM_MENU|wx.MINIMIZE_BOX|wx.CLOSE_BOX)
> >         menubar =3D wx.MenuBar()
> >         self.SetMenuBar(menubar)
> >         dlg =3D 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 =3D wx.StaticText(self, -1, "ID", style =3D
> > wx.ALIGN_LEFT)
> >         self.statusST =3D wx.StaticText(self, -1, "Status", style =3D
> > wx.ALIGN_LEFT)
> >         self.typeST =3D wx.StaticText(self, -1, "Type", style =3D
> > wx.ALIGN_LEFT)
> >         self.id2ST =3D wx.StaticText(self, -1, "ID", style =3D
> > wx.ALIGN_LEFT)
> >         self.galleryST =3D wx.StaticText(self, -1, "Gallery", style =3D
> > wx.ALIGN_LEFT)
> >         self.dateRangeST =3D wx.StaticText(self, -1, "Date Range", style
> > =3D wx.ALIGN_LEFT)
> >
> >         #Fields
> >         self.idTC =3D wx.TextCtrl(self, -1)
> >         statusList =3D ['Status', 'to', 'be', 'chosen']
> >         self.statusCB =3D wx.ComboBox(self, 500, "Choose from below",
> > (90, 50),
> >                          (160, -1), statusList,
> >                          wx.CB_DROPDOWN)
> >         typeList =3D ['Types', 'to', 'be', 'chosen']
> >         self.typeCB =3D wx.ComboBox(self, 500, "Choose from below", (90,
> > 50),
> >                          (160, -1), typeList,
> >                          wx.CB_DROPDOWN)
> >         self.id2TC =3D wx.TextCtrl(self, -1)
> >         galleryList =3D ['Gallery', 'stuff', 'will', 'be', 'ordered']
> >         galleryList.sort()
> >         self.galleryCB =3D wx.ComboBox(self, 500, "Choose from below",
> > (90, 50),
> >                          (160, -1), galleryList,
> >                          wx.CB_DROPDOWN)
> >         self.initialDateRange =3D wx.DatePickerCtrl(self, size=3D(120,-=
1),
> >                                 style=3Dwx.DP_DROPDOWN |
> > wx.DP_SHOWCENTURY)
> >         self.finalDateRange =3D wx.DatePickerCtrl(self, size=3D(120,-1),
> >                                 style=3Dwx.DP_DROPDOWN |
> > wx.DP_SHOWCENTURY)
> >         #Checkboxes
> >         self.idCheck =3D wx.CheckBox(self,-1)
> >         self.statusCheck=3D wx.CheckBox(self,-1)
> >         self.typeCheck =3D wx.CheckBox(self,-1)
> >         self.id2Check =3D wx.CheckBox(self,-1)
> >         self.galleryCheck =3D wx.CheckBox(self,-1)
> >         self.dateRangeCheck =3D wx.CheckBox(self,-1)
> >
> >         #Buttons
> >         self.searchB =3D wx.Button(self, wx.ID_ANY, "Search")
> >
> >         #Sizers
> >         self.fgs =3D wx.FlexGridSizer(8,3,4,4)
> >         items =3D [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 =3D wx.App()
> > MainWindow(None, -1)
> > app.MainLoop()
>
> I was able to get this code to run under GTK+ (Ubuntu Dapper, Python
> 2.4.3, wxPython 2.8.7.1) by removing the reference to self.id in the
> items list.
>
> However, although the corrected app runs, I still get an error message:
>
> (python:18816): Gtk-CRITICAL **: gtk_window_resize: assertion `width >
> 0' failed
>
> I've seen occasional Gtk-CRITICAL messages before, but never known how
> to fix them.
>
> Mark
>
>
>
>
>
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200805=
08/1313f798/attachment.htm


More information about the wxpython-users mailing list