Basic user input / output

Hi there,
I'm a newbie to GUI programming and am finding wxPython very helpful
in designing a frontend to my command line program. I've managed to
get all the buttons and text boxes I need using an IDE, but am
wondering how to grab user input from my polygonSides, process it with
the OnCalculateAreaButton and output it to the fieldAreaOutput.

Here's the code:
        self.polygonSides = wx.TextCtrl(id=wxID_FRAME1POLYGONSIDES,
              name=u'polygonSides', parent=self.panel1, pos=wx.Point(16, 48),
              size=wx.Size(100, 21), style=0, value=u'')

        self.fieldAreaOutput = wx.TextCtrl(id=wxID_FRAME1FIELDAREAOUTPUT,
              name=u'fieldAreaOutput', parent=self.panel1, pos=wx.Point(16,
              136), size=wx.Size(100, 21), style=0, value=u'')

    def OnCalculateAreaButton(self, event):
        event.Skip()

Previous experience of using wxPython was by using "Python Card".
Where you could do things like this to output:

    def on_decrBtn_mouseClick(self, event):
        startValue = int(self.components.field1.text)
        endValue = startValue - 1
        self.components.field1.text = str(endValue)

So it would be helpful to know how to do this kind of thing properly
with wxPython.

Thanks for reading, and thanks to the makers of wxPython. :slight_smile:

Hal

Hal Lorenz wrote:

Hi there,
I'm a newbie to GUI programming and am finding wxPython very helpful
in designing a frontend to my command line program. I've managed to
get all the buttons and text boxes I need using an IDE, but am
wondering how to grab user input from my polygonSides, process it with
the OnCalculateAreaButton and output it to the fieldAreaOutput.

Here's the code:
       self.polygonSides = wx.TextCtrl(id=wxID_FRAME1POLYGONSIDES,
             name=u'polygonSides', parent=self.panel1, pos=wx.Point(16, 48),
             size=wx.Size(100, 21), style=0, value=u'')

       self.fieldAreaOutput = wx.TextCtrl(id=wxID_FRAME1FIELDAREAOUTPUT,
             name=u'fieldAreaOutput', parent=self.panel1, pos=wx.Point(16,
             136), size=wx.Size(100, 21), style=0, value=u'')

   def OnCalculateAreaButton(self, event):
       event.Skip()

Previous experience of using wxPython was by using "Python Card".
Where you could do things like this to output:

   def on_decrBtn_mouseClick(self, event):
       startValue = int(self.components.field1.text)
       endValue = startValue - 1
       self.components.field1.text = str(endValue)

So it would be helpful to know how to do this kind of thing properly
with wxPython.

Thanks for reading, and thanks to the makers of wxPython. :slight_smile:

Hal

That's great ! Too bad this option isn't passed on to wx.FileDialog ...

Ray Pasco