Hello,
I'm writing here, not '-users' mailing list because this problem seems to be
some kind of bug.
After creating wxFrame object (or another widget), such python built-in
functions as 'eval' and 'float' seems to be broken. For example,
'eval("1.432")', which should produce 1.432, produces 1.0, and float("0.43")
raises ValueError ("invalid literal for float(): 0.43"), but should produce
0.43 float number. This happenѕ only with wxPython 2.5.
I've written an example program to watch what's going on:
import wx
print "Good eval:", eval("-5.323")
print "Good float:", float("-3.324")
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title)
p = wx.Panel(self, -1)
b = wx.Button(p, -1, "Do It", (10,10))
self.Bind(wx.EVT_BUTTON, self.JustDoIt, b)
print "Bad eval:", eval("-5.323")
print "Bad float:", float("-3.324")
app = wx.PySimpleApp()
f = MyFrame(None, "What's up?")
f.Show()
app.MainLoop()
$ python wxpyapp.py
Good eval: -5.323
Good float: -3.324
Bad eval: -5.0
Traceback (most recent call last):
File "wxpyapp.py", line 18, in ?
f = MyFrame(None, "What's up?")
File "wxpyapp.py", line 13, in __init__
print "Bad float:", float("-3.324")
ValueError: invalid literal for float(): -3.324
I haven't tried another functions, just these. What could you say about that?
Martynas
···
--
The best way of learning is learning by doing.
http://mjoc.sig.lt