G
Gary
Good afternoon:
I've playing with dynamically created buttons in Boa Constructor using
wxPython:
def OnBtnButton(self, event):
btnIds = []
self.btn2 = []
xx = 24; yy = 42
for cntr in range(168):
self.btn2.append(wxButton(self.panel1, -1, str(cntr + 1),
wxPoint(xx, yy), wxSize(23, 23), 0))
rr = self.btn2[cntr].GetId()
yy += 26
if (yy + 44) > 380: # Nearing bottom of frame
yy = 42 # Back to top of frame
xx += 26 # starts new column
btnIds.append(str(rr))
func = ['self.BtnFunc1', 'self.BtnFunc2', 'self.BtnFunc3'..]
for ew in range(24):
EVT_BUTTON(self, self.btn2[ew].GetId(), eval(func[ew]))
def BtnFunc1(self, event):
self.t1.SetValue("btnOne")
def BtnFunc2(self, event):
self.t1.SetValue("btnTwo")
def BtnFunc3(self, event):
self.t1.SetValue("btnThree")
# etc…
How can I press one of the buttons and have it return a reference to
itself? (Some other languages have something like root._name or
self._name). Thanks.
--
I've playing with dynamically created buttons in Boa Constructor using
wxPython:
def OnBtnButton(self, event):
btnIds = []
self.btn2 = []
xx = 24; yy = 42
for cntr in range(168):
self.btn2.append(wxButton(self.panel1, -1, str(cntr + 1),
wxPoint(xx, yy), wxSize(23, 23), 0))
rr = self.btn2[cntr].GetId()
yy += 26
if (yy + 44) > 380: # Nearing bottom of frame
yy = 42 # Back to top of frame
xx += 26 # starts new column
btnIds.append(str(rr))
func = ['self.BtnFunc1', 'self.BtnFunc2', 'self.BtnFunc3'..]
for ew in range(24):
EVT_BUTTON(self, self.btn2[ew].GetId(), eval(func[ew]))
def BtnFunc1(self, event):
self.t1.SetValue("btnOne")
def BtnFunc2(self, event):
self.t1.SetValue("btnTwo")
def BtnFunc3(self, event):
self.t1.SetValue("btnThree")
# etc…
How can I press one of the buttons and have it return a reference to
itself? (Some other languages have something like root._name or
self._name). Thanks.
--