簡體   English   中英

嘗試運行簡單 Kivy 程序時出錯 (Windows)

[英]Error When Trying to Run Simple Kivy Program (Windows)

嘗試在我的計算機上運行以下程序時:

# 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。

如果那真的是你的程序,那么問題就在於它什么都不做。 使用TutorialApp().run()實際啟動 gui。

無論哪種方式,回溯都不是錯誤。

看起來您缺少pygame的安裝 - Kivy 安裝未將其作為依賴項引入,因此您需要單獨安裝它 - 請參閱http://kivy.org/docs/installation/troubleshooting-macosx.html#無法找到任何有價值的窗口提供者錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM