kivy 给出“无法获得窗口" [英] kivy gives 'Unable to get a Window'

查看:69
本文介绍了kivy 给出“无法获得窗口"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Window 7、Python 2.7 上安装了 kivy.当我运行以下代码时:

I installed kivy on my Window 7, Python 2.7. When I run the following code:

import kivy

from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):
    def build(self):
        return Label(text='Hello World!')

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

它给出了以下错误:

无法获取窗口,中止.

我在 Python 3.4 上试过,同样的错误.

I tried on Python 3.4, same error.

推荐答案

sdl2有一个选项是找不到加载*.png所需的dll

There is an option that sdl2 can't find dlls needed to load *.png

  • 尝试查找libpng16-16.dll

在我的电脑上:C:\Python27\share\gstreamer\bin

  • 添加到路径

  • Add it to PATH

set PATH=C:\Python27\share\gstreamer\bin;%PATH%

这是临时解决方案,但对我有用

This is temporary solution but it works for me

这篇关于kivy 给出“无法获得窗口"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆