让Kivy最终在Eclipse中工作,然后编译错误:CRITICAL Application没有创建窗口。终止应用程序运行

时间:2015-08-31 16:04:30

标签: eclipse python-3.x pydev kivy

就像我提到的那样,我终于让Kivy在Eclipse Pydev for Windows 7中编译而没有任何错误。当我运行该文件时,我收到了该错误,当然没有弹出窗口。有谁知道为什么以及如何解决错误?

main.py

import kivy
kivy.require('1.9.0')  # @UndefinedVariable

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder

presentation = Builder.load_file("test.kv")

class StartScreen(FloatLayout):
    pass


class TestApp(App):

    def build(self):
        return presentation



if __name__=='__main__':
    TestApp().run()

test.kv     #:kivy 1.9

<StartScreen>:
    orientation: 'vertical'
    canvas:
        Color:
            rgba: 1,0,1,1
        Rectangle:
            source: 'kivy/graphics/blu.png'

    FloatLayout:

我经历了确保安装了pygame并且我能够在没有错误的情况下导入它。我安装了Cython以及它是Kivy的依赖。升级后出现新错误。看起来像是同样的错误但不同:

[INFO              ] [Logger      ] Record log in C:\Users\qzfyrp\.kivy\logs\kivy_15-08-31_29.txt
[INFO              ] [Kivy        ] v1.9.0
[INFO              ] [Python      ] v3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)]
[INFO              ] [Factory     ] 173 symbols loaded
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pil (img_sdl2, img_ffpyplayer ignored)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider at all!
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Kivy\kivy34\kivy\core\__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Kivy\kivy34\kivy\core\window\window_sdl2.py", line 26, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL          ] [App         ] Unable to get a Window, abort.

编辑:好的。起初,当我开始这个时,当我通过kivy.bat运行时,我能够得到至少一个屏幕。不,当我尝试通过kivy.bat运行时,我得到了与Eclipse相同的错误。

1 个答案:

答案 0 :(得分:1)

我在LiClipse中遇到了同样的错误,并按照Kivy, Eclipse and PyDev (also PyPy)上一篇文章中的说明解决了这个错误。

只需打开窗口 - &gt;首选项,在树中导航到PyDev - &gt;口译员 - &gt; Python解释器转到标志环境并将变量路径添加到SDL2目录。