Tuesday 15 March 2011

python - Difference between wx.TextCtrl .write / .WriteText / .AppendText -



python - Difference between wx.TextCtrl .write / .WriteText / .AppendText -

i new python , new wxpython well. wondering if there difference between these wx.textctrl functions. mini code shows 3 times same output. if there no difference, there historic reason these functions?

import wx class testui(wx.panel): textctrl = '' def __init__(self, parent, name): super(testui, self).__init__(parent, name=name) self.buildui() self.show(true) self.textctrl.write('bli\n') self.textctrl.writetext('bla\n') self.textctrl.appendtext('blub\n') def buildui(self): self.textctrl = wx.textctrl(self, style=wx.te_multiline|wx.te_readonly) box = wx.boxsizer(wx.vertical) box.add(self.textctrl, proportion=1, flag=wx.expand) def main(): app = wx.app(false) root = wx.frame(parent=none, title='testui') testui(parent=root, name='testui') root.show(true) app.mainloop() # standard boilerplate phone call main() function. if __name__ == '__main__': main()

thanks :)

the 3 methods appear functionally same. however, argue utilize appendtext adding additional text text command create you're doing clear in code itself. of time, utilize setvalue. have used writetext when redirecting stdout, that's it. can read utilize case here:

http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/

python wxpython textctrl wxtextctrl

No comments:

Post a Comment