How to set a wx.textctrl can editable or readonly?
Hako
princismo at yahoo.com.tw
Wed Jan 18 09:00:13 EST 2006
Hello All,
I have a function to set readonly or editable of a textctrl. I'd like
to make the textctrl initial set readonly and use other event funciton
to set editable of the textctrl but it always can editable. How to set
a textctrl can editable or readonly?
Any Ideas? (see short snippet below)
Thanks.
-----------------------------------
self.tcFirstName = wx.TextCtrl(id=wxID_FRAME1TCFIRSTNAME,
name=u'tcFirstName', parent=self.panel2, pos=wx.Point(16,
32),
size=wx.Size(168, 24), style=0, value=u'')
self.setForm()
def setForm(self):
self.Readonly("ro")
def Readonly(self, flag):
if flag=="ro":
self.tcFirstName.style=wx.TE_READONLY
self.tcFirstName.Refresh()
self.tcFirstName.SetBackgroundColour(self.panel1.GetBackgroundColour())
else:
self.tcFirstName.style=0
self.tcFirstName.Refresh()
self.tcFirstName.SetBackgroundColour((255,255,255))
# Other event function set textctrl can editable
def OnBAddButton(self, event):
self.Readonly("o")
-------------------------------------------
end
More information about the Python-list
mailing list