Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/04/2015, 14:58
ArturoJ
 
Fecha de Ingreso: abril-2015
Ubicación: Canarias
Mensajes: 7
Antigüedad: 9 años, 1 mes
Puntos: 0
Externalizando funcion (Error)

Buenas, estoy intentando llamar a una funcion con un modulo externalizado.
pero no consigo hacerlo funcionar sin enbargo cuando lo uso en el mismo modulo "sin externalizar" funciona sin problemas.

Código Python:
Ver original
  1. import wx
  2. import sys
  3. import acciones_Left_01
  4.  
  5. # Constructor o inicializador
  6. class Ventanas_L_R(wx.Frame):
  7.     def __init__(self, parent, id, title):
  8.         wx.Frame.__init__(self, parent, id, title, size=(450, 400))
  9.        
  10.         # Asociamos con la variable panel
  11.         panel = wx.Panel(self, -1)
  12.        
  13.         # Caja texto Izquierda
  14.         self.vbox = wx.BoxSizer(wx.VERTICAL)
  15.         self.hbox = wx.BoxSizer(wx.HORIZONTAL)
  16.        
  17.         # Caja texto Derecha
  18.         self.vbox2 = wx.BoxSizer(wx.VERTICAL)
  19.        
  20.         # Creamos los paneles
  21.         self.leftPanel = wx.Panel(panel, -1)
  22.         self.rightPanel = wx.Panel(panel, -1)
  23.        
  24.  
  25.         # Botones Izquierda
  26.         boton_01 = wx.Button(self.leftPanel, -1, 'Menu 1', size=(100, -1))
  27.         boton_02 = wx.Button(self.leftPanel, -1, 'Menu 2', size=(100, -1))
  28.         #test = wx.Button(self.rightPanel, -1, 'Apply', size=(100, -1))
  29.        
  30.         # Accion del boton 1
  31.         self.Bind(wx.EVT_BUTTON, acciones_Left_01.anadir, id=boton_01.GetId())
  32.  
  33.         # Anadimos los 2 botones de la izquierda
  34.         self.vbox2.Add(boton_01, 0, wx.TOP, 5)
  35.         self.vbox2.Add(boton_02, 0)
  36.         self.leftPanel.SetSizer(self.vbox2)
  37.  
  38.         # Anadimos los paneles de manera ancho
  39.         self.hbox.Add(self.leftPanel, 0, wx.EXPAND | wx.RIGHT, 5)
  40.         self.hbox.Add(self.rightPanel, 1, wx.EXPAND | wx.LEFT, 10)
  41.  
  42.         # Tamano Horizontal de Paneles
  43.         panel.SetSizer(self.hbox)
  44.        
  45.         # Posicion que aparecera la ventana
  46.         self.Centre()
  47.         # Accion para aparecer la ventana visual
  48.         self.Show(True)
  49.  
  50.  
  51. # Inicializador  
  52. app = wx.App()
  53. Ventanas_L_R(None, -1, 'Ventanas_L_R')
  54. app.MainLoop()

Modulo externalizado
Código Python:
Ver original
  1. import wx
  2. # Accion de crear botones en la derecha
  3. def anadir(self,event):
  4.     self.test2 = wx.Button(self.rightPanel, 0, 'Nuevo 1', pos=(10, 10),size=(120, -1))
  5.     self.test3 = wx.Button(self.rightPanel, -1, 'Nuevo 2', pos=(10, 100), size=(100, -1))

Me tira este error:
TypeError: anadir() missing 1 required positional argument: 'event'

Gracias