Re: [wxpython-users] Why can't I run this code?
by Mark Erbaugh other posts by this author
May 8 2008 3:06PM messages near this date
[wxpython-users] Why can't I run this code?
|
Re: [wxpython-users] Why can't I run this code?
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 =(
> 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()
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@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
David Anderson
Mark Erbaugh
David Anderson
Mark Erbaugh
Christopher Barker
Mark Guagenti
|