Estoy con wxpython y utilizando 2 paneles en una misma ventana.
Código:
import wx #---------------------------------------------------------------------- class RightPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent=parent) self.texto = wx.StaticText(self, -1, 'Test',(230,10), style=wx.ALIGN_CENTRE) #<------ Label que quiero cambiar #---------------------------------------------------------------------- class LeftPanel(RightPanel): def __init__(self, parent): wx.Panel.__init__(self, parent=parent) hbox = wx.BoxSizer(wx.HORIZONTAL) vbox = wx.BoxSizer(wx.VERTICAL) panel1 = wx.Panel(self, -1) self.tree = wx.TreeCtrl(panel1, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT|wx.TR_DEFAULT_STYLE) root = self.tree.AddRoot('Programmer') os = self.tree.AppendItem(root, 'Programas') pl = self.tree.AppendItem(root, 'Programas en Python 3.4') self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.Cambiar_Texto_Label, id=1) vbox.Add(self.tree, -1, wx.EXPAND) hbox.Add(panel1, -1, wx.EXPAND) panel1.SetSizer(vbox) self.SetSizer(hbox) self.Centre() def Cambiar_Texto_Label(self, event): #<------- Accion para cambiar label item = event.GetItem() self.texto.SetValue(item) #<------- Accion para cambiar Label #---------------------------------------------------------------------- class Cagador_Ventana(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Panel", size=(1100,660)) splitter = wx.SplitterWindow(self) leftP = LeftPanel(splitter) rightP = RightPanel(splitter) splitter.SplitVertically(leftP, rightP) splitter.SetMinimumPaneSize(250) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(splitter, 1, wx.EXPAND) self.SetSizer(sizer) self.Centre() #---------------------------------------------------------------------- if __name__ == "__main__": app = wx.App(False) frame = Cagador_Ventana() frame.Show() app.MainLoop() app.MainLoop()