• buschfsu

    success!! thanks

    i didnt know i needed

    tv = sender.superview[ ]

    but it makes sense when i look at what i did for the input text field
    bandin

    thanks!!!!

    posted in Pythonista read more
  • buschfsu

    Ok here is the script. It grabs text from a csv file on an ftp server. If i put the textview outside of the button action the string is undefined. Sorry hope im being clear

    # coding: utf-8
    
    import ui
    import csv
    from  ftplib import FTP
    from StringIO import StringIO
    
    ftp = FTP('Server.com')
    ftp.login()
    ftp.set_pasv(True)
    r= StringIO()
    ftp.retrbinary('RETR record.csv',r.write)
    
    
        
    def buttonGo(sender):
        
        alist = list()
        bandin = sender.superview['band']
    
        r.seek(0)
        csvfile=csv.reader(r.getvalue ().splitlines (),delimiter=',')
    
        for row in csvfile:
            if row[0] == bandin.text:
                alist.append(row[1])
        
        strlist = str()
        
        strlist = ',' .join(alist)
        
        textview1 = ui.TextView()
        textview1.text = str(strlist)
        
        print strlist
        
     
                
    v = ui.load_view('vinyl q app')
    if ui.get_screen_size()[1] >= 768:
        # 
        v.present('popover')
    else:
        # iPhone
        v.present(orientations=['portrait'])
    

    posted in Pythonista read more
  • buschfsu

    ok i used the following within my defbuttonGo(sender);

    textview1 = ui.TextView()
    textview1.text = str(strlist)

    print strlist

    and i dont get an error. the print command works and gets the right string to the console but again the textview does not update with the string information, it stays blank

    posted in Pythonista read more
  • buschfsu

    new to python and programming but i have coded a ui that will give me the output i want (a string) when i press a button. i can include the print command in my buttons function and will print the string to the console but i can't find a way to populate the textview with this string. i have tried the following ...

    def buttonGo(sender);
    <function that produces a string called strlist>

    textview1 = ui.TextView()             # creates textview1 as a TextView
    textview1.text = strlist                   # assigns textview1's text attribute to the string  'strlist'
    

    fails with a message that i can edit ui.textview

    very new to this but hope its something simple im overlooking.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!