I am working on a project with Twitter which must be accessed through Tkinter, the fact is that I had first designed a function only in python, I used a 'For' loop and with print I saw what this gave me as result. The fact is that as a Tkinter widget I invoke the function I need that I return these results so they can appear in the GUI. It is known that when you see the first return the loop is finished, so I need to know a way for the function to return all the values I need without any problem. Next I put the code of the function and the part of the Tkinter, since I want to put this information in a Text widget. Thank you very much, I hope for a prompt response.
def timeline():
for status in tweepy.Cursor(api.home_timeline).items(2):
# Procesa el home timeline
return (status.user.name)
return (status.user.screen_name)
return (status.text.translate(non_bmp_map))
And I need to put that information in a text widget that looks like this:
tweets=Text(stream,bg='Sky Blue',fg='white')
tweets.pack(padx=10,pady=10 )
tweets.config(state='normal')
tweets.insert(END,timeline())
tweets.config(state='disabled')