我正在使用 Feedparser 来获取 RSS 新闻并显示新闻标题import feedparserimport kivykivy.require('1.0.6') # replace with your current kivy version !from kivy.app import Appfrom kivy.uix.label import Labelclass MyApp(App): def build(self): d=feedparser.parse('https://en.wikinews.org/w/index.php?title=Special:NewsFeed&feed=rss&categories=Published¬categories=No%20publish%7CArchived%7cAutoArchived%7cdisputed&namespace=0&count=15&ordermethod=categoryadd&stablepages=only') print (len(d['entries'])) for post in d['entries']: news=post.title print(news) return Label(text=news)if __name__ == '__main__': MyApp().run()即news=post.title使用 kivy 标签。原来的输出如下:Study suggests Mars hosted life-sustaining habitat for millions of yearsNASA's TESS spacecraft reports its first exoplanetRussians protest against pension reformUS rapper Mac Miller dies at home in Los AngelesCreativity celebrated at Fan Expo Canada 2018 in TorontoBrisbane, Australia Magistrates Court charges two cotton farmers with $20m fraud Fossil genome shows hybrid of two extinct species of humanSinger Aretha Franklin, 'queen of soul', dies aged 76New South Wales, Australia government says entire state in winter 2018 droughtReal Madrid agrees with Chelsea FC to sign goalkeeper Thibaut Courtois但是,每当我运行程序时,Kivy 应用程序只显示循环中的最后一个标题IE:Real Madrid agrees with Chelsea FC to sign goalkeeper Thibaut Courtois关于我缺少什么的任何想法?任何帮助将不胜感激。
添加回答
举报
0/150
提交
取消