尝试在我的计算机上运行以下程序时:
# First import an App class from kivy
from kivy.app import App
# Define App subclass
class TutorialApp(App):
pass
if __name__=="__main__":
TutorialApp().run()
在我添加建议内容后(最后两行),我得到两个语法错误,第一个告诉我删除冒号,第二个告诉我删除缩进,然后这个:
[INFO ] Kivy v1.8.0
[INFO ] [Logger ] Record log in C:\Users\rabbitrabbit\.kivy \logs\kivy_14-08-15_5.txt
[INFO ] [Factory ] 157 symbols loaded
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_pygame, img_pil ignored)
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeout=3600s
[DEBUG ] [App ] Loading kv <C:\Python33\tutorial.kv>
[DEBUG ] [App ] kv <C:\Python33\tutorial.kv> not found
[DEBUG ] [Window ] Ignored <egl_rpi> (import error)
[DEBUG ] [Window ] Ignored <pygame> (import error)
[WARNING ] [WinPygame ] SDL wrapper failed to import!
[DEBUG ] [Window ] Ignored <sdl> (import error)
[DEBUG ] [Window ] Ignored <x11> (import error)
[CRITICAL ] [Window ] Unable to find any valuable Window provider at all!
[CRITICAL ] [App ] Unable to get a Window, abort.
根据我跟随(http://inclem.net/2014/01/09/kivy-crash-course/1_making-a-simple-app/)的教程,程序应该能够顺利运行。我已经安装了Kivy和Python 3.3。
答案 0 :(得分:1)
如果这真的是你的计划,那么问题就在于它没有做任何事情。使用TutorialApp().run()
实际启动gui。
无论哪种方式,该回溯都不是错误。
答案 1 :(得分:0)
看起来你错过了pygame
的安装 - 它没有被Kivy安装作为依赖项拉入,所以你需要单独安装它 - 请参阅http://kivy.org/docs/installation/troubleshooting-macosx.html#unable-to-find-any-valuable-window-provider-error