Through trial and error (as well as a lot of reading of the docs), I've
gotten somewhat closer ... I think. Here's how the class begins:
class modModel(wx.Panel):
def _init_ctrls(self, prnt):
gbs = self.gbs = wx.GridBagSizer(5,5)
# generated method, don't edit
wx.Panel.__init__(self, id=wxID_MODMODEL, name='modModel', parent=prnt,
pos=wx.Point(382, 318), size=wx.Size(700, 500), style=wx.TAB_TRAVERSAL)
self.SetToolTipString('Model information')
self.SetClientSize(wx.Size(700, 500))
Then I define the widgets. Below that I have:
gbs.Add(self, wxID_MODMODELMODNAMELAB, (0,0), wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
gbs.Add(self, wxID_MODMODELMODNAMETXT, (0,1), (0,2), wx.ALL, 5)
gbs.Add(self, wxID_MODMODELMODDESCLAB, (0,3), wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
gbs.Add(self, wxID_MODMODELMODDESCTXT, (0,4), (1,3), wx.ALL, 5)
Without the 'self' I get all sorts of errors. Now, the error message is a
python error:
File "/mnt/usr2/fuzzy/eikos/ui/modModel.py", line 139, in __init__
gbs.Add(self, wxID_MODMODELMODNAMELAB, (0,0), wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
NameError: global name 'gbs' is not defined
I thought that gbs was local; obviously python disagrees. How should I
define gbs in this context?
Thanks,
Rich
···
On Thu, 17 Nov 2005, E. A. Tacao wrote:
Do you mean GridBagSizer? If you do, you can just call a
gbs = self.gbs = wx.GridBagSizer(5, 5)
gbs.Add(self, modNameLab, (0,0))
wxPython is wondering why are you trying to put 'self' 4 times inside
the same sizer...
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863