Changing default text in a TextCtrl.

Hello!

How can I change the default text in a TextCtrl?

I have tested the SetLabel function, but it didn't work. Do I have to create
a new TextControl object? Didn't see any obvious functions in the Window class
either. But, I could of course have missed it.

Oerjan...

···

#################################################

#!/usr/bin/python

#10_panelupdate.py

import wx
import wx.lib.inspection

class MyFrame(wx.Frame):
     def __init__(self, *args, **kwargs):
         wx.Frame.__init__(self, *args, **kwargs)

         self.p1 = wx.Panel(self)
         st = wx.TextCtrl(self.p1, -1, 'String')
         st.SetLabel('Another string')
         # st = wx.TextCtrl(self.p1, -1, 'Another string')

class MyApp(wx.App):
     def OnInit(self):
         frame = MyFrame(None, -1, '10_panelupdate.py')
         frame.Show()
         self.SetTopWindow(frame)
         return 1

if __name__ == "__main__":
     app = MyApp(0)
# wx.lib.inspection.InspectionTool().Show()
     app.MainLoop()

Hello,

···

On Feb 1, 2009, at 10:47 AM, Ørjan Pettersen wrote:

Hello!

How can I change the default text in a TextCtrl?

wx.TextCtrl(parent, id, ..., value='')
TextCtrl.SetValue("hello")

Cody

And if you need not generate the event wx.EVT_COMMAND_TEXT_UPDATED,
TextCtrl.ChangeValue(“hello”)

···

2009/2/1 Cody Precord codyprecord@gmail.com

Hello,

On Feb 1, 2009, at 10:47 AM, Ørjan Pettersen wrote:

Hello!

How can I change the default text in a TextCtrl?

wx.TextCtrl(parent, id, …, value=‘’)

TextCtrl.SetValue(“hello”)

Cody


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users