I have a simple mini notepad program written in wxPython. the text is written in TextCtrl:
self.rtb = wx.TextCtrl(self, ID_RTB, size=wx.Size(400,200), style=wx.TE_MULTILINE | wx.TE_RICH2)
I wanted to implement a search feature where user gives a word and I'm highlighting it in the TextCtrl.
my method is:
def SearchIt(self,e): for line in self.rtb: if self.text in line: print line #will be changed to highlight when it will work
However i get an error:
TypeError: 'TextCtrl' object is not iterable
any suggestion how to resolve it? It's too complex to change the TextCtrl now. is there another way I can search a word in the TextCtrl or maybe a way to convert the text in TextCtrl to another data structure just for the search?