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 37 38 39
|
import wx
class Bonjour(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None,-1, title = titre, size = (450, 200))
self.i = 0
self.g = wx.Gauge(self, -1, 50, (110, 95), (250, 25))
self.button = wx.Button(self, 10, 'Click !', (20, 20))
self.Bind(wx.EVT_TIMER, self.TimerHandler)
self.Bind(wx.EVT_BUTTON, self.OnClick, self.button)
def __del__(self):
self.timer.Stop()
def TimerHandler(self, event):
self.g.Pulse()
def OnClick(self, event):
self.timer = wx.Timer(self)
self.timer.Start(100)
## Temporisation
while self.i <> 9999999 :
self.i = self.i + 1
class MonApp(wx.App):
def OnInit(self):
fen = Bonjour("Exemple 1")
fen.Show(True)
self.SetTopWindow(fen)
return True
app = MonApp()
app.MainLoop() |
Partager