1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
import wx
import wx.xrc
from wx.lib.intctrl import IntCtrl
from wx.lib.masked import NumCtrl
class FormPersonne ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 843,512 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
bSizer1 = wx.BoxSizer( wx.VERTICAL )
self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"MONTANT", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText3.Wrap( -1 )
bSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
self.m_montant = NumCtrl( self, wx.ID_ANY, value=0, pos=wx.DefaultPosition, size=wx.DefaultSize,style= 0,integerWidth = 15, fractionWidth = 2,autoSize=True )
bSizer1.Add( self.m_montant, 0, wx.ALL, 5 )
self.SetSizer( bSizer1 )
self.Layout()
self.Centre( wx.BOTH )
def __del__( self ):
pass
if __name__ == '__main__':
app = wx.App()
frame = FormPersonne(None)
montantString='1234,56'
montant=float(montantString.replace(',','.'))
print(montant,type(montant))
frame.m_montant.SetValue(montant)
frame.Show()
app.MainLoop() |
Partager