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
class Fenetre(wx.Frame):
""" Cadre non redimensionnable """
def __init__(self):
wx.Frame.__init__(self, None, -1, "Window Test",
style = wx.DEFAULT_FRAME_STYLE
& ~ (wx.RESIZE_BORDER | wx.RESIZE_BOX | wx.MAXIMIZE_BOX))
self.SetClientSizeWH(391, 402) # adapte la taille du cadre selon l'interieur
self.panel = Plateau(self)
class Plateau(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, pos = (0, 0), size = (391, 402))
plate = wx.EmptyBitmap(391, 402) # remplissage bitmap pour l'exemple
self.tampon = wx.EmptyBitmap(391, 402)
self.dc = wx.BufferedDC(wx.ClientDC(self), self.tampon)
self.dc.DrawBitmap(plate, 0, 0, False)
self.Bind(wx.EVT_PAINT, self.onPaint)
def onPaint(self, event):
print "evenement PAINT" # juste pour montrer la boucle
self.dc = wx.BufferedPaintDC(self, self.tampon)
#=================================================
app = wx.App()
win = Fenetre()
win.Show()
app.MainLoop() |
Partager