wxTextCtrl Demo from wxPython Wiki Pages ....

Folks,

I,ve been having trouble running an example from the wxPython Wiki pages.
The source code goes thus:

from wxPython.wx import *
import types, string

class FloatControl(wxTextCtrl):
        def __init__ (
            self, parent,id = -1,[value= 0.0],
            pos = wxDefaultPosition, size = wxDefaultSize,
            [choices =[]],
            style = 0, validator = wxDefaultValidator,name = "float"):
                wxTextCtrl.__init__(self, parent,-1)
        def get(self):
                return self.fromGUI( self.GetValue())
        def set(self, value):
                self.SetValue(self.toGUI(value))

        def toGUI( self, value ):
                if not type(value) in ( types.FloatType, types.IntType,
types.LongType):
                        raise ValueError ('''FloatControl requires float
values, passed %s'''%repr(value))
                return str(value)
        def fromGUI( self, value ):
                return string.atof( value )

app = wxPySimpleApp()
frame = FloatControl(None,-1)
frame.Show()
app.MainLoop()

The python interpreter returns with the following error:

File "FloatControlPyApp_1.py", line 11
    self, parent,id = -1,[value= 0.0],
                         ^
SyntaxError: invalid syntax

Who can help? Any contribution will be deeply appreciated.

Cheers,
Ashu Akoachere

The python interpreter returns with the following error:

File "FloatControlPyApp_1.py", line 11
    self, parent,id = -1,[value= 0.0],
                         ^
SyntaxError: invalid syntax

Get rid of the [ and ] brackets, would be my first suggestion.

You also seem to have trouble checking the mail list for an answer to your first email. Sending the same message again and again and again does not help anything.

···

Dipl._-Ing._Ashu_Akoachere/Private_Edition@limbe.eurobell.co.uk wrote:

Folks,

I,ve been having trouble running an example from the wxPython Wiki pages.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!