Buenas llevo mas o menos 2 semanas aprendiendo a programar en python, y me encuentro en una encrucijada. Necesito sacar información de Ventana_New (tc1) y llevarlo al Ventana.SetTitle, no se como podría hacerlo, gracias. Ahí va mi código:
import wx class Aplicacion(wx.App): def OnInit(self): self.frame = Ventana(None, -1, title = "Control Horario") self.SetTopWindow(self.frame) self.frame.Show() return True class Ventana(wx.Frame): def __init__(self, parent, id, title): super(Ventana, self).__init__(parent, id, title, size = (800, 275)) panel = wx.Panel(self) menubar = wx.MenuBar() arcm = wx.Menu() anmi = wx.MenuItem(arcm, ID_NUEVO, "&Nuevo\tCtrl+N") arcm.AppendItem(anmi) menubar.Append(arcm, '&Archivo') self.SetMenuBar(menubar) self.Bind(wx.EVT_MENU, self.OnMenu) def OnMenu(self, event): evt_id = event.GetId () if evt_id == ID_NUEVO: self.frame = Ventana_New(None, -1, title = "Nuevo Usuario") class Ventana_New(wx.Frame): def __init__(self, parent, id, title): self.padre = parent wx.Frame.__init__(self, parent, id, title, size = (295, 357)) self.panel = Panel_New(self) self.Show(True) class Panel_New(wx.Panel): def __init__(self, parent, *args, **kwargs): self.padre = parent wx.Panel.__init__(self, parent, *args, **kwargs) gs = wx.FlexGridSizer(3, 2, 9, 9) vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) nombre = wx.StaticText(self, -1, "Nombre:") self.tc1 = wx.TextCtrl(self, -1, size = (150, -1)) gs.AddMany([(nombre), (self.tc1, 1, wx.LEFT, 10)] self.btn = wx.Button(self, -1, 'Aceptar', size = (-1, 30)) hbox.Add(self.btn) vbox.Add(hbox, 0, wx.ALIGN_CENTER | wx.BOTTOM, 10) self.Bind(wx.EVT_BUTTON, self.OnAceptar, id = self.btn.GetId()) self.SetSizer(vbox) def OnAceptar(self, event): padre = self.GetParent() padre.Close(True)
_______________________________________________ Python-es mailing list Python-es@python.org http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/