no tab traversal?

What am I doing wrong? According to my reading of the docs, no special
action is needed so that the tab character can be used to advance
between different TextCtrls, but tabs don't do anything in the code
fragment below -- at least not on Mac and Linux.

Brian

import wx
import sys

···

#---------------------------------------------------------------------------
class InputFrame(wx.Frame):
    def __init__(self, parent, log, prefix, inputlist, calibfile):
        wx.Frame.__init__(self,
                          parent=parent,
                          )
        self.statbar = self.CreateStatusBar()
        self.userinfo = {}

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # box for scan parameters
        sizer = self.ScanParmsBox(self)
        mainSizer.Add(sizer, 0, wx.ALIGN_CENTER, 0)

        mainSizer.Fit(self)
        mainSizer.Layout()
        self.SetSizer(mainSizer)
        self.Fit()
        self.Show()

    def ScanParmsBox(self, frame):
        'create box for scan parameters'
        box1 = wx.StaticBox(frame, -1, "Descriptive information")
        sizer = wx.StaticBoxSizer(box1, wx.VERTICAL)

        sizer0 = wx.FlexGridSizer(rows=2, cols=6)
        sizer.Add(sizer0, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        for (widget,label,ToolTip) in [
            ('proposal',"Proposal Number*",
             'Enter a proposal number here'),
            ('ESAF','ESAF Number*',
             'Enter a ESAF number here'),
            ('sampleid',"Sample Name",
             'Enter a name for the sample here'),
            ('chemname',"Chemical Name*",
             'Enter a chemical name for the sample here'),
            ('formula',"Chemical Formula*",
             'Enter a chemical formual for the sample here'),
            ('barcode', "Database ID*",
             'Unique database identifier (barcode)')
            ]:
            label = wx.StaticText(self, -1, label,
style=wx.ALIGN_CENTER)
            sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
            if widget == 'proposal':
                self.userinfo[widget] = wx.TextCtrl(self, -1,

style=wx.TE_PROCESS_ENTER)
            else:
                self.userinfo[widget] = wx.TextCtrl(self, -1)

            self.userinfo[widget].SetToolTipString(ToolTip)
            sizer0.Add(self.userinfo[widget], 0, wx.ALIGN_CENTRE|
wx.ALL, 0)

        sizer0 = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(sizer0, 0, wx.ALIGN_LEFT|wx.ALL, 5)
        label = wx.StaticText(self, -1, "Scan Parms*: ",
style=wx.ALIGN_CENTER)
        sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
        for (widget,label,ToolTip) in [
            ('startangle',"Start",
             'Enter the scan starting angle here'),
            ('endangle'," End",
             'Enter the scan ending angle here'),
            ('stepsize'," Step",
             'Enter the scan step size here'),
            ('steptime'," Step time (s)",
             'Enter the scan step time here'),
            ('T',' Temp. (K)','Enter the measurement temperature in K
here'),
            ]:
            label = wx.StaticText(self, -1, label,
style=wx.ALIGN_CENTER)
            sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
            self.userinfo[widget] = wx.TextCtrl(self, -1,
size=(50,20))
            self.userinfo[widget].SetToolTipString(ToolTip)
            sizer0.Add(self.userinfo[widget], 0, wx.ALIGN_CENTRE|
wx.ALL, 0)
        return sizer

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = InputFrame(None, sys.stdout, None, None, None)
    frame.Show(True)
    app.MainLoop()

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

···

On Thu, Apr 22, 2010 at 4:36 PM, bht <toby@anl.gov> wrote:

What am I doing wrong? According to my reading of the docs, no special
action is needed so that the tab character can be used to advance
between different TextCtrls, but tabs don't do anything in the code
fragment below -- at least not on Mac and Linux.

You need to put your controls as child of a Panel object and not the Frame.

Cody

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks very much for the explanation.

It helped a lot. Tabs now work, but I am still missing something
because now the panel is drawn shifted to the left so as initially
displayed I can only see the controls on the right side. (This is on
the Mac, on Linux it works fine). As soon as I resize the frame
manually, the panel shifts to the right place.

Brian

import wx

···

On Apr 22, 4:39 pm, Cody Precord <codyprec...@gmail.com> wrote:

You need to put your controls as child of a Panel object and not the Frame.

#---------------------------------------------------------------------------
class InputFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent=parent,
                          )
        self.userinfo = {}
        panel = wx.Panel(self)
        self.statbar = self.CreateStatusBar()

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        sizer = self.ScanParmsBox(panel)
        mainSizer.Add(sizer, 0, wx.ALIGN_CENTER, 0)

        mainSizer.Fit(panel)
        mainSizer.Layout()
        panel.SetSizer(mainSizer)
        self.Fit()

    def ScanParmsBox(self, frame):
        'create box for scan parameters'
        box1 = wx.StaticBox(frame, -1, "Descriptive information")
        sizer = wx.StaticBoxSizer(box1, wx.VERTICAL)

        sizer0 = wx.FlexGridSizer(rows=2, cols=6)
        sizer.Add(sizer0, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        for (widget,label,ToolTip) in [
            ('proposal',"Proposal Number*",
             'Enter a proposal number here'),
            ('ESAF','ESAF Number*',
             'Enter a ESAF number here'),
            ('sampleid',"Sample Name",
             'Enter a name for the sample here'),
            ('chemname',"Chemical Name*",
             'Enter a chemical name for the sample here'),
            ('formula',"Chemical Formula*",
             'Enter a chemical formual for the sample here'),
            ('barcode', "Database ID*",
             'Unique database identifier (barcode)')
            ]:
            label = wx.StaticText(frame, -1, label,
style=wx.ALIGN_CENTER)
            sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
            if widget == 'proposal':
                self.userinfo[widget] = wx.TextCtrl(frame, -1,

style=wx.TE_PROCESS_ENTER)
            else:
                self.userinfo[widget] = wx.TextCtrl(frame, -1)

            self.userinfo[widget].SetToolTipString(ToolTip)
            sizer0.Add(self.userinfo[widget], 0, wx.ALIGN_CENTRE|
wx.ALL, 0)

        sizer0 = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(sizer0, 0, wx.ALIGN_LEFT|wx.ALL, 5)
        label = wx.StaticText(frame, -1, "Scan Parms*: ",
style=wx.ALIGN_CENTER)
        sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
        for (widget,label,ToolTip) in [
            ('startangle',"Start",
             'Enter the scan starting angle here'),
            ('endangle'," End",
             'Enter the scan ending angle here'),
            ('stepsize'," Step",
             'Enter the scan step size here'),
            ('steptime'," Step time (s)",
             'Enter the scan step time here'),
            ('T',' Temp. (K)','Enter the measurement temperature in K
here'),
            ]:
            label = wx.StaticText(frame, -1, label,
style=wx.ALIGN_CENTER)
            sizer0.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 3)
            self.userinfo[widget] = wx.TextCtrl(frame, -1,
size=(50,20))
            self.userinfo[widget].SetToolTipString(ToolTip)
            sizer0.Add(self.userinfo[widget], 0, wx.ALIGN_CENTRE|
wx.ALL, 0)

        return sizer

#---------------------------------------------------------------------------
# define the working directory
if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = InputFrame(None)
    frame.Show(True)
    app.MainLoop()

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

···

On Thu, Apr 22, 2010 at 11:03 PM, bht <toby@anl.gov> wrote:

On Apr 22, 4:39 pm, Cody Precord <codyprec...@gmail.com> wrote:

You need to put your controls as child of a Panel object and not the Frame.

Thanks very much for the explanation.

It helped a lot. Tabs now work, but I am still missing something
because now the panel is drawn shifted to the left so as initially
displayed I can only see the controls on the right side. (This is on
the Mac, on Linux it works fine). As soon as I resize the frame
manually, the panel shifts to the right place.

The code is a little hard to read since it is so mangled by including
it inline in the email. If you want to attach your code in a file it
would be easier to look at.

Cody

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en