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