I've tried every way I can possibly see to try and convert the value from the numctrl to a decimal but the problem lies with the retrieved value being a float.
I cant covert the float to a string first because it looses the trailing 0 in values such as 1.30 which I need because I am trying to represent currency.
Does anyone know the way forward or what I am doing wrong please?
import wx from wx.lib.masked import NumCtrl from decimal import * class MyFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Quick Silver', size = (180, 100)) context = Context(prec = 2) setcontext(context) panel = wx.Panel(self) lolinput = wx.lib.masked.NumCtrl(panel, pos = (20,20), fractionWidth = 2) # for 2 decimal places. lolinput.SetValue(1.30) x = Decimal(lolinput.GetValue(), 2) context.create_decimal(x) print x app = wx.App(redirect = False) frame = MyFrame(parent = None, id = -1) frame.Show() app.MainLoop()