Dear wx geeks!!
How can i know what button was pressed?
I need to make some different windows that use the very same class but deppending on the button that was pressed the information on the new window would differ. So i need to make a whole bunch of buttons so every different button makes a different behaviour.
But i dont want to make the same number of functions 1 for each button … so the question is … how can i know WHICH button was pressed?
just to avoid this … and that up to 19 times
self.ventana.utiles_pbu1 = wx.Button(self.ventana, -1, ‘Calcular’, size=(70,25))
self.ventana.utiles_pbu1.Bind(wx.EVT_BUTTON, self.calc_utiles_pbu1)
self.ventana.utiles_pbu2 = wx.Button(self.ventana, -1, ‘Calcular’, size=(70,25))
self.ventana.utiles_pbu2.Bind(wx.EVT_BUTTON, self.calc_utiles_pbu2)
self.ventana.utiles_pbu3 = wx.Button(self.ventana, -1, ‘Calcular’, size=(70,25))
self.ventana.utiles_pbu3.Bind(wx.EVT_BUTTON, self.calc_utiles_pbu3)
def calc_utiles_pbu1 (self):
self.grupo = ‘plantabaja:usoprincipal’
Sup_utiles()
def calc_utiles_pbu2 (self):
self.grupo = ‘plantabaja:usosecundario’
Sup_utiles()
def calc_utiles_pbu3 (self):
self.grupo = ‘plantabaja:usoterciario’
Sup_utiles()
many thanks for your time…