zoukankan      html  css  js  c++  java
  • Kivy SDL2: Unable to load image

    2020-08-06 19:03:44,843 MainThread WARNING : Image: Unable to load image <C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivydataglsldefault.png>
    2020-08-06 19:03:44,848 MainThread CRITICAL : Window: Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
    sdl2 - Exception: SDL2: Unable to load image
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 71, in core_select_lib
        cls = cls()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 152, in __init__
        super(WindowSDL, self).__init__()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindow\__init__.py", line 981, in __init__
        self.create_window()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 312, in create_window
        super(WindowSDL, self).create_window()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindow\__init__.py", line 1258, in create_window
        self.render_context = RenderContext()
      File "kivygraphicsinstructions.pyx", line 783, in kivy.graphics.instructions.RenderContext.__init__
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 561, in __init__
        self.filename = arg
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 756, in _set_filename
        mipmap=self._mipmap, nocache=self._nocache)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 460, in load
        im = loader(filename, **kwargs)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 223, in __init__
        self._data = self.load(filename)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimageimg_sdl2.py", line 47, in load
        raise Exception('SDL2: Unable to load image')
    

    这个文件C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivydataglsldefault.png 是存在的

    处理办法:在导入kivy模块前添加一下代码

    import os 
    os.environ['KIVY_IMAGE'] = 'pil,sdl2'
    

    参考:https://github.com/kivy/kivy/issues/4115

  • 相关阅读:
    Gridview如何用自定义按钮进行编辑和提交修改
    winform多线程中给datagridview绑定数据源
    DevExpress控件WebchartControl的学习记录
    datagridview右键选中单元格并获取到焦点
    asp.net局部页面打印,以及如何去掉打印时自动保留的URL地址(页眉页脚)
    GridView如何实现点击某行的指定列弹出新窗体
    C# Color Font 与String之间的转换
    推荐一款 asp.net js日历控件
    js浮点运算替代函数
    VSeWss 1.3 CTP 安装后出现错误
  • 原文地址:https://www.cnblogs.com/onsunsl/p/Kivy_SDL2_Unable_to_load_image.html
Copyright © 2011-2022 走看看