En el Glade puedes añadirle el nombre de tu EventHandler.
O si lo prefieres hacer manual:
Código Python:
Ver original#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.5 (standalone edition) on Wed Dec 19 10:19:46 2012
import wx
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
# Tool Bar
self.frame_1_toolbar = wx.ToolBar(self, -1)
self.SetToolBar(self.frame_1_toolbar)
self.button_Herramienta1 = self.frame_1_toolbar.AddLabelTool(1, "HERRAMIENTA1", wx.Bitmap("1.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Herramienta1", "Herramienta1")
self.button_Herramienta2 = self.frame_1_toolbar.AddLabelTool(2, "HERRAMIENTA2", wx.Bitmap("2.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Herramienta2", "Herramienta2")
# Tool Bar end
#Defino los dos paneles
self.panel_1 = wx.Panel(self, -1)
self.sizer_3_staticbox = wx.StaticBox(self.panel_1, -1, "PANEL DE LA HERRAMIENTA 1 - UNO")
self.panel_2 = wx.Panel(self, -1)
self.sizer_3_staticbox = wx.StaticBox(self.panel_1, -1, "PANEL DE LA HERRAMIENTA 2 - DOS")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.OnClickHerramienta1, self.button_Herramienta1)
self.Bind(wx.EVT_BUTTON, self.OnClickHerramienta2, self.button_Herramienta2)
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("frame_1")
self.frame_1_toolbar.SetToolBitmapSize((32, 32))
self.frame_1_toolbar.Realize()
self.panel_1.SetBackgroundColour(wx.Colour(216, 191, 216))
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
self.sizer_3_staticbox.Lower()
sizer_3 = wx.StaticBoxSizer(self.sizer_3_staticbox, wx.HORIZONTAL)
self.panel_1.SetSizer(sizer_3)
sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
def OnClickHerramienta1(self, event):
self.panel_1.Show()
self.panel_2.Hide()
self.Layout()
event.Skip()
def OnClickHerramienta2(self, event):
self.panel_1.Hide()
self.panel_2.Show()
self.Layout()
event.Skip()
# end of class MyFrame
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()