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

Recommended Answers

All 2 Replies

Probably delete the equal sign at line 7.

Brilliant !

Thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.