self.MainButtons=
self.MainBtnNames=("How Many / Last Week - sheets","Diagrams","Other
reports","Exit")
self.MainSizer=wxBoxSizer(wxVERTICAL)
cnt=1;l=len(self.MainBtnNames)
for s in self.MainBtnNames:
btnid=1200+cnt
if (cnt==l): btnid=1200
b=wxButton(self,btnid,s)
b.SetBackgroundColour(wxColour(40, 136, 216))
if btnid==1200: self.MainSizer.Add(b,1,wxALL|wxEXPAND,8)
else: self.MainSizer.Add(b,1,wxALL|wxEXPAND,8)
EVT_BUTTON(self,btnid,self.OnClickBtn)
self.MainButtons.append(b)
cnt=cnt+1
def OnClickBtn(self,e):
print e.???
I want to get the ID of button to do the needed thing.
I must use this form, because more and more buttons needed, and I don't
want to write the same code time to time.
So: how can I get this ID ?
And how can I set the mainform to the center of the screen ?
self.MainButtons=
self.MainBtnNames=("How Many / Last Week -
sheets","Diagrams","Other
reports","Exit")
self.MainSizer=wxBoxSizer(wxVERTICAL)
cnt=1;l=len(self.MainBtnNames)
for s in self.MainBtnNames:
btnid=1200+cnt
if (cnt==l): btnid=1200
b=wxButton(self,btnid,s)
b.SetBackgroundColour(wxColour(40, 136, 216))
if btnid==1200:
self.MainSizer.Add(b,1,wxALL|wxEXPAND,8)
else:
self.MainSizer.Add(b,1,wxALL|wxEXPAND,8)
EVT_BUTTON(self,btnid,self.OnClickBtn)
self.MainButtons.append(b)
cnt=cnt+1
def OnClickBtn(self,e):
print e.???
I want to get the ID of button to do the needed thing.
I must use this form, because more and more buttons needed, and I
don't want to write the same code time to time.