0

Could someone please give me a pointer as to why my use of appendText fails?

This is my first bit of programming for 30 years - I'm sorry if its an idiot mistake :)

The program has 2 text fields. You paste a list of url's into the first box (area1), hit the 'Convert' button, and it (should) output a list of properly formatted links in area2 ready to paste into a web page.

Ie

http://www.domain.com/file/pics/01_Overview.jpg

 becomes

<a href=http://www.domain.com/file/pics/01_Overview.jpg target=_blank>http://www.domain.com/file/pics/01_Overview.jpg</a>

The code snippet I have works perfectly, but nothing gets output to box 2.
If I un-comment the 2 print lines, the link's 'ref' and contents get printed in the interpreter exactly as it should be.

def on_Convert_mouseClick(self, event):
    amountOfLines = self.components.TextArea1.getNumberOfLines()
    ref=0
    while ref < amountOfLines:
        line = self.components.TextArea1.getLineText(ref)
        line = '<a href='+line+' target=_blank>'+line+'</a>\n'
        self.components.TextArea2.appendText = (line)
#       print ref
#       print line
        ref=ref+1

using python 2.7 and pythoncard on win64

Edited by p34i: remove live links

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by p34i
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.