wxpython, How to display buttons label into textctrl area -


i new wxpython struggling this. want create button label , label when press button displayed textctrl area,for example cellphone, when press 1 number 1 displayed on screen!

import wx   class example(wx.frame):      def __init__(self,parent,id):         wx.frame.__init__(self,parent,id,' title', size = (205,330))         panel = wx.panel(self, wx.id_any)         textctrl = wx.textctrl(panel, -1,("0"), pos=(10, 10),size=(170, 60))           button=wx.button(panel,label="1",pos=(100,210),size=(30,30))         self.bind(wx.evt_button, self.onbutton, button)      def onbutton (self,evt):         label = evt.geteventobject().getlabel()   if __name__=='__main__':     app=wx.pysimpleapp()     frame=example(parent=none,id=-1)     frame.show()     app.mainloop() 

thanks

you need keep references controls - can set them:

import wx  class example(wx.frame):     def __init__(self,parent,id):         wx.frame.__init__(self,parent,id,' title', size = (205,330))         panel = wx.panel(self, wx.id_any)         self.textctrl = wx.textctrl(panel, -1,(""), pos=(10, 10),size=(170, 60))         self.button=wx.button(panel,label="1",pos=(100,210),size=(30,30))         self.bind(wx.evt_button, self.onbutton, self.button)     def onbutton (self,evt):         label = evt.geteventobject().getlabel()         #self.textctrl.setvalue(label)         self.textctrl.appendtext(label)   if __name__=='__main__':     app=wx.pysimpleapp()     frame=example(parent=none,id=-1)     frame.show()     app.mainloop() 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -