标题:python kivy问题无法load_file
只看楼主
dtxwz
Rank: 2
等 级:论坛游民
帖 子:79
专家分:45
注 册:2011-9-18
结帖率:100%
 问题点数:0 回复次数:0 
python kivy问题无法load_file
hello.py

from kivy.app import App
from kivy.lang import Builder
presentation = Builder.load_file("SimpleKivy.kv")
class MainApp(App):
    def build(self):
        return presentation()

MainApp().run()


SimpleKivy.kv

<Button>:
    font_size:40
    color:0,1,0,1
    size_hint:0.3,0.2

<FloatLayout>:
    Button:
        text:"Kivy"
        pos_hint:{"x":0,'y': 0}
    Button:
        text:"tutor"
        pos_hint:{"right":0.5,'top':1}



报错

   File "C:/Users/yuncong/PycharmProjects/test/hello.py", line 8, in <module>
     MainApp().run()
   File "C:\Users\yuncong\Anaconda3\lib\site-packages\kivy\app.py", line 800, in run
     root = self.build()
   File "C:/Users/yuncong/PycharmProjects/test/hello.py", line 6, in build
     return presentation()
 TypeError: 'NoneType' object is not callable
搜索更多相关主题的帖子: python app Button Users line 
2018-10-06 10:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-490190-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.368548 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved