number of textctrl entries based on user's input

Jaime Carrera wrote:

I'm new to GUI programming,so I'd like to know if what I attempt to do is feasible:

It sure is.

On a textctrl box a user is required to enter the number of input files required and I'd like to generate a number of "textctrl" and radio button widgets based on the upper textctrl. So if the user enters 5, I'd like to generate 5 textctrl with their corresponding radio buttons.

Not only is this feasible, it's quite easy with Python and wxPython, and great way to build your GUIs.

Here is a bit of pseudo code that will give you the idea:

(self) is a Panel you're putting this all on:

def BuildTextControls(self, NumberOfFiles):

     self.FileControls =
     for i in range(NumberOfFiles)
  tc = wx.TextCtrl(self, ...)
         rb = wx.RadioButton(self, ...)
         self.FileControls.append((tc, rb))
         # self.FilesSizer is probably one of the GridSizers,
         # defined elsewhere in this Panel class
         self.FilesSizer.Add(rb)
         self.FilesSizer.Add(tc)
     self.Layout()

I hope that gives you an idea...

-Chris

ยทยทยท

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov