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
|
#!/usr/bin/python
# -*- coding: cp1252 -*-
# Tempo02.py
import wx
#-------------------------------------------------------------------------
class MaBarreOutils(wx.ToolBar):
"""Barre d'outils de la fenêtre principale"""
#-------------------------------------------------------------------------
def __init__(self, parent):
wx.ToolBar.__init__(self, parent)
TBFLAGS = ( wx.TB_HORIZONTAL
| wx.NO_BORDER
| wx.TB_FLAT
)
client = parent
tb = wx.ToolBar(client, style=TBFLAGS)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(tb, 0, wx.EXPAND)
client.SetSizer(sizer)
tsize = (24,24)
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize)
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize)
tb.SetToolBitmapSize(tsize)
#tb.AddSimpleTool(10, new_bmp, "New", "Long help for 'New'")
tb.AddLabelTool(10, "New", new_bmp, shortHelp="New", longHelp="Long help for 'New'")
parent.Bind(wx.EVT_TOOL, self.OnExit, id=10)
#tb.AddSimpleTool(20, open_bmp, "Open", "Long help for 'Open'")
tb.AddLabelTool(20, "Open", open_bmp, shortHelp="Open", longHelp="Long help for 'Open'")
parent.Bind(wx.EVT_TOOL, self.OnExit, id=20)
tb.Realize()
def OnExit(self, event):
wx.MessageBox("Coucou, je suis dans la Méthode : OnExit(self, evt) ^-^ ", "OnExit(self, evt)") |
Partager