Bonjour,
je débute en wx python voici mon code :
self``.ButtonYes ``=
wx.RadioButton(``self``.win, ``66``,``"YES"``, (``180``, ``190``))
FPAct_grid.Add(``self``.ButtonYes, (``10``,``1``),(``1``,``1``))
self``.ButtonYes.SetValue(``True``)
self``.Yes ``=
1
wx.EVT_RADIOBUTTON(``self``, ``66``, ``self``.YesRadioButton)
self``.ButtonNo ``=
wx.RadioButton(``self``.win, ``67``,``"NO"``, (``230``, ``190``))
FPAct_grid.Add(``self``.ButtonNo, (``12``,``1``),(``1``,``1``))
self``.ButtonNo.SetValue(``False``)
self``.No ``=
0
wx.EVT_RADIOBUTTON(``self``, ``67``, ``self``.NoRadioButton)
self``.Activate ``=
wx.StaticText(``self``.win, ``68``, ``"activate"``, (``40``, ``190``))
FPAct_grid.Add(``self``.Activate,(``13``,``1``),(``1``,``1``))
self``.Cpa ``=
wx.StaticText(``self``.win, ``69``, ``"Cpa [1-27]"``, (``40``, ``240``))
FPAct_grid.Add(``self``.Cpa,(``14``,``1``),(``1``,``1``))
self``.CpaFrame ``=
wx.TextCtrl(``self``.win, ``70``,"", (``180``,``240``))
FPAct_grid.Add(``self``.CpaFrame,(``3``,``0``),(``1``,``1``))
wx.EVT_TEXT(``self``, ``70``, ``self``.GetCpaNumber)
sampleList1 ``=
[``'0'``, ``'1'``, ``'2'``, ``'3'``, ``'4'``, ``'5'``, ``'6'``, ``'7'``, ``'8'``, ``'9'``, ``'10'``, ``'11'``, ``'12'``, ``'13'``, ``'14'``, ``'15'``]
wx.StaticText(``self``.FPGAwin, ``73``, ``"ADD :"``, (``40``, ``320``))
self``.ch ``=
wx.Choice(``self``.win, ``74``, (``180``, ``320``), choices ``=
sampleList1)
self``.Bind(wx.EVT_CHOICE, ``self``.EvtChoice, ``self``.ch)
self``.StartFrame ``=
wx.StaticText(``self``.win, ``75``, ``"Size [0-4095]"``, (``40``, ``360``))
FPAct_grid.Add(``self``.StartFrame,(``17``,``1``),(``1``,``1``))
self``.Cpr ``=
wx.TextCtrl(``self``.win, ``76``,"", (``180``,``360``))
FPAct_grid.Add(``self``.Cpr,(``4``,``0``),(``1``,``1``))
self``.BasicFrame ``=
wx.StaticText(``self``.win, ``77``, ``"Basic [0-38399]"``, (``40``, ``400``))
FPAct_grid.Add(``self``.BasicFrame,(``18``,``1``),(``1``,``1``))
self``.Basic ``=
wx.TextCtrl(``self``.win, ``78``,"", (``180``,``400``))
FPAct_grid.Add(``self``.Basic,(``5``,``0``),(``1``,``1``))
self``.``Type
=
wx.StaticText(``self``.win, ``79``, ``"Type :"``, (``40``, ``440``))
FPAct_grid.Add(``self``.``Type``,(``19``,``1``),(``1``,``1``))
listderoulante ``=
wx.Choice(``self``.win, ``80``, (``180``, ``440``), choices``=``[``'0'``, ``'1'``, ``'2'``, ``'3'``])
def
GetCpaNumber(``self``, event):
``a ``=
event.GetInt()
``print
a
``if
a ``in
range
(``1``,``28``):
``print
ok
``else``:
``dlg ``=
wx.MessageDialog(``self``, ``'entrer une valeur entre 1 et 27'``,
``'LRDec Info'``,
``wx.OK | wx.ICON_INFORMATION
``)
``dlg.ShowModal()
``dlg.Destroy()
def
EvtChoice(``self``, event):
``self``.choice(``'EvtChoice: %s\n'
%
event.GetString())
``self``.ch.Append(``"A new item"``)
``if
event.GetString() ``=``=
'one'``:
``self``.choice(``'Well done!\n'``)
def
YesRadioButton(``self``, event):
``self``.Yes ``=
event.Checked()
``print
'Yes : %d'
%``(``self``.Yes)
``if
event.Checked() ``=``=
1``:
``Configuration[``'Activate'``] ``=
1
``print
'Configuration Activate :'
``print
Configuration[``'Activate'``]
def
NoRadioButton(``self``, event):
``self``.No ``=
event.Checked()
``print
'No : %d'
%``(``self``.No)
``if
event.Checked() ``=``=
1``:
``Configuration[``'Activate'``] ``=
0
``print
'Configuration activate :'
``print
Configuration[``'Activate'``]
en effet, je voudrais faire dans le champs cpa (rentrer des valeurs entre 1 et 27 sinon afficher un message d’erreur), et aussi ajouter des événements à la liste de choix,
est ce qu’il y a quelqu’un qui aura une idée s’il vous plait !
``