hello,
i am quiet new into python scripting. after reading some docs i've tried to create a script for reading a (notepad) text file containing tabs (it's a sorted list). this is a code fragment:
f = open(rootdir + "list.txt")
data = f.read()
self.test = xbmcgui.controltextbox(50, 130, 670, 400, "font12", "0xffffffff")
self.addcontrol(self.test)
self.test.settext(data)
self.setfocus(self.test)
when i start the script in xbmc i'll see the textfile in the controlbox,but all the tabs are replaced with a strange block character and the text is not lined up. am i doing something wrong? please help.
regards,
marc
Handling tabs in a controltextbox
dikkesnoek
Senior Member Posts: 108 Joined: Apr 2004 Reputation: 0 |
2005-08-18 21:30
Post: #1
|
| find quote |
Nuka1195
Skilled Python Coder Posts: 3,914 Joined: Dec 2004 Reputation: 17 |
2005-08-18 23:40
Post: #2
data = data.replace('\t', ' ')
set ' ' to the number of spaces you want |
| find quote |
dikkesnoek
Senior Member Posts: 108 Joined: Apr 2004 Reputation: 0 |
2005-08-19 13:45
Post: #3
thanks nuka,
question is, will it also align the text. for example: thistext 1 (two tabs) thatistext 2 (one tab) if you replace character $09 with spaces you will get possibly: thistext 1 thatistext 2 í don't know why $09 will not be treaded as a real tab in a controltextbox. regards, marc |
| find quote |


Search
Help