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 35 36
|
#!/usr/bin/env python
import wx
class Essai(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(200,150), pos=(30,30))
panel = wx.Panel(self, -1)
# test 1
Texte = wx.StaticText(panel, -1, 'Test : ', pos=(10,20))
Texte1 = wx.StaticText(panel, -1, 'ok', pos=(45,20))
Btn1 = wx.Button(panel, -1, 'Click', pos=(100,15))
# test 2
ChampTxt = wx.TextCtrl(panel, -1, '', pos=(10,50), size=(75,-1))
Btn2 = wx.Button(panel, -1, 'Remplir', pos=(100,50))
Btn1.Bind(wx.EVT_BUTTON, self.OnClick, Btn1)
Btn2.Bind(wx.EVT_BUTTON, self.OnFill, Btn2)
self.Centre()
self.Show(True)
def OnClick(self, event):
self.Texte1.SetValue('coucou')
def OnFill(self, event):
self.ChampTxt.SetValue('ok')
if __name__ == "__main__":
app = wx.App()
Essai(None, -1, 'Essai')
app.MainLoop() |
Partager