Fresh Eyes Needed

I have not seen this on the mail list, so I apologize if it did appear
without my notice.

···

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

---------- Forwarded message ----------

   My test applet for a pop-up dialog box works ... almost correctly. The
first wx.StaticText() needs to be pushed down manually to be visible, and
its associated wx.TextCtrl() displays in the upper left corner rather than
to the right of the label.

   I look and look, but cannot see what I'm doing differently here from any
other sizer I've created. Therefore, I ask for fresh eyes to look at the
code below because I'm just not seeing my error here.

TIA,

Rich

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
---------------------------------------------------------------------
#!/usr/bin/env python

import wx
from pysqlite2 import dbapi2 as sqlite3

class varDlg(wx.Dialog): # Used to add a new variable
   def __init__(self):
     wx.Dialog.__init__(self, None, wx.ID_ANY, "Add a New Variable", size=(800, 400))

     sizer = wx.BoxSizer(wx.VERTICAL)
     box1 = wx.BoxSizer(wx.HORIZONTAL)
     box2 = wx.BoxSizer(wx.HORIZONTAL)
     box3 = wx.BoxSizer(wx.HORIZONTAL)
     box4 = wx.BoxSizer(wx.HORIZONTAL)
     buttonBox = wx.BoxSizer(wx.HORIZONTAL)

     nameLab = wx.StaticText(self, wx.ID_ANY, 'Variable Name: ')
     varName = wx.TextCtrl(self, wx.ID_ANY, size=wx.Size(125, 25),
                           style=wx.TAB_TRAVERSAL|wx.RAISED_BORDER)

     descLab = wx.StaticText(self, wx.ID_ANY, 'Variable Description: ')
     varDesc = wx.TextCtrl(self, wx.ID_ANY, size=(125, 50),
                           style=wx.TAB_TRAVERSAL|wx.TE_MULTILINE|
                           wx.TE_PROCESS_ENTER|wx.RAISED_BORDER)

     polLab = wx.StaticText(self, wx.ID_ANY, 'Parent Policy: ')
     polName = wx.TextCtrl(self, wx.ID_ANY, size=(125, 25),
                           style=wx.TAB_TRAVERSAL|wx.RAISED_BORDER)

     subLab = wx.StaticText(self, wx.ID_ANY, 'Parent Sub-Policy: ')
     subName = wx.TextCtrl(self, wx.ID_ANY, size=(125, 25),
                           style=wx.TAB_TRAVERSAL|wx.RAISED_BORDER)

     line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)

     OkBut = wx.Button(self, wx.ID_OK, 'OK')
     self.Bind(wx.EVT_BUTTON, self.OnOK)

     CancelBut = wx.Button(self, wx.ID_CANCEL, 'Cancel')
     self.Bind(wx.EVT_BUTTON, self.OnCancel)

     OkBut.SetDefault()

     box1.Add(nameLab, 0, wx.ALL, 5)
     box1.Add(varName, 0, wx.ALL, 5)
     box2.Add(descLab, 0, wx.ALL, 5)
     box2.Add(varDesc, 0, wx.ALL, 5)
     box3.Add(polLab, 0, wx.ALL, 5)
     box3.Add(varName, 0, wx.ALL, 5)
     box4.Add(subLab, 0, wx.ALL, 5)
     box4.Add(subName, 0, wx.ALL, 5)
     buttonBox.Add(OkBut, 0, wx.ALL, 5)
     buttonBox.Add(CancelBut, 0, wx.ALL, 5)

     # sizer.Add((100, 20), 0)
     sizer.Add(box1, 1, wx.EXPAND|wx.ALL, 5)
     sizer.Add(box2, 1, wx.EXPAND|wx.ALL, 5)
     sizer.Add(box3, 1, wx.EXPAND|wx.ALL, 5)
     sizer.Add(box4, 1, wx.EXPAND|wx.ALL, 5)
     sizer.Add(line, 1, wx.GROW|wx.RIGHT|wx.TOP, 5)
     sizer.Add(buttonBox, 1, wx.CENTER|wx.ALL, 5)

     self.SetSizer(sizer)
     sizer.Fit(self)

   # bound methods start here.

   def OnOK(self, event):
     pass

   def OnCancel(self, event):
     pass

# end of class varDlg

if __name__ == '__main__':
   app = wx.App()
   myd = varDlg()
   myd.Show(True)
   app.MainLoop()

Oops, you added varName twice to two different sizers!

Lee ← Not that I haven’t done such meself…

···

On Thu, 2006-11-09 at 09:43 -0800, Rich Shepard wrote:

   My test applet for a pop-up dialog box works ... almost correctly. The
first wx.StaticText() needs to be pushed down manually to be visible, and
its associated wx.TextCtrl() displays in the upper left corner rather than
to the right of the label.

   I look and look, but cannot see what I'm doing differently here from any
other sizer I've created. Therefore, I ask for fresh eyes to look at the
code below because I'm just not seeing my error here.

TIA,

Rich

“There is nothing remarkable about it. All one has to do is press the right keys at the right time and the computer programs itself.” (ala J.S. Bach)

Unless otherwise stated, any views presented in this e-mail are solely those of the author and do not necessarily represent those of the company.

Oy! That was it, all right.

   I must have looked at every line at least two dozen times, and I never saw
that! Thank you very much, Lee.

Rich

···

On Thu, 9 Nov 2006, Lee Merrill wrote:

Oops, you added varName twice to two different sizers!

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863