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 40 41 42 43 44 45 46 47 48 49 50
| #! /usr/bin/env python
#-*- coding: utf-8 -*-
import wx
import wx.lib.scrolledpanel as scrolled
class Scroll(scrolled.ScrolledPanel):
def __init__(self, parent, doublons):
scrolled.ScrolledPanel.__init__(self, parent, -1, style = wx.SUNKEN_BORDER, pos = (10, 10), size = (750, 400))
liste = wx.BoxSizer(wx.VERTICAL)
for d in doublons:
blocdoublon = wx.BoxSizer(wx.HORIZONTAL)
for k in range(2):
blocdossier = wx.BoxSizer(wx.VERTICAL)
blocdossier.Add(wx.StaticText(self, -1, "nom dossier"), 0, wx.EXPAND|wx.ALL, 10)
blocdossier.Add(wx.StaticText(self, -1, "date"), 0, wx.EXPAND|wx.ALL, 10)
blocdoublon.Add(blocdossier,0,wx.ALIGN_CENTRE)
liste.Add(blocdoublon,0,wx.EXPAND)
self.SetSizer(liste)
self.SetAutoLayout(1)
class MaFrame(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None, -1, title = titre)
self.masque = wx.Panel(self, -1, size = (800, 600))
self.doublons = [0, 1, 2, 3, 4]
self.centre = Scroll(self.masque, self.doublons)
self.centre.SetupScrolling()
bouton = wx.Button(self.masque, -1, "Changer", pos=(10, 420))
self.Fit()
self.Bind(wx.EVT_BUTTON, self.UpdateCont, bouton)
def UpdateCont(self, evt):
self.doublons.append(self.doublons[-1]+1)
self.centre.Destroy()
self.centre = Scroll(self.masque, self.doublons)
self.centre.SetupScrolling()
class MyApp(wx.App):
def OnInit(self):
frame = MaFrame("Titre")
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp()
app.MainLoop() |