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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| #!/usr/bin/env python
# -*- coding: cp1252 -*-
# module2.py
import wx
#-------------------------------------------------------------------------
class Barre_Outils_01(wx.Panel):
"""Barre d'outils de la fenêtre principale"""
#-------------------------------------------------------------------------
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
TBFLAGS = ( wx.TB_HORIZONTAL
| wx.NO_BORDER
| wx.TB_FLAT
)
tb = wx.ToolBar(self, style=TBFLAGS) # self
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(tb, 0, wx.EXPAND)
self.SetSizer(sizer)
tsize = (24,24)
# Définition des différents icones de la barre d'outils
Png_01 = wx.Bitmap("exit.png")
Png_02 = wx.Bitmap("book.png")
Png_03 = wx.Bitmap("linux.png")
tb.SetToolBitmapSize(tsize)
# Dessine la Barre d'outils
tb.AddLabelTool(10, "", Png_01)
tb.AddSeparator()
tb.AddLabelTool(20, "", Png_02)
tb.AddSeparator()
tb.AddLabelTool(30, "", Png_03)
tb.AddSeparator()
tb.Realize()
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
class Interface_Graphique_01(wx.Panel):
"""Interface_Graphique de la fenêtre principale"""
#-------------------------------------------------------------------------
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
# Initialise les différents Sizer
vbox_top = wx.BoxSizer(wx.VERTICAL)
vbox = wx.BoxSizer(wx.VERTICAL)
#*********************************************************
# panel1
panel1 = wx.Panel(self, -1)
panel1.SetBackgroundColour('#4f5049') # Gris foncé
midpan = wx.Panel(panel1, -1, size=(300, 300))
midpan.SetBackgroundColour('#ededed') # Gris clair
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(midpan, 1, wx.EXPAND | wx.ALL, 20)
panel1.SetSizer(sizer)
vbox.Add(panel1, 0, wx.EXPAND)
vbox.Add((-1, 10))
#*********************************************************
# panel2
panel2 = wx.Panel(self, -1)
bouton = wx.Button(panel2, -1, 'Close', size=(50, -1))
sizer2 = wx.BoxSizer(wx.HORIZONTAL)
sizer2.Add(bouton)
panel2.SetSizer(sizer2)
vbox.Add(panel2, 1, wx.BOTTOM)
vbox_top.Add(vbox, 1, wx.EXPAND | wx.ALL, 10)
self.SetSizer(vbox_top) |