zoukankan      html  css  js  c++  java
  • 转载一篇文章 python程序在安卓手机上使用

    from kivy.app import App
    from kivy.uix.button import Button
    
    class TestApp(App):
        def build(self):
            return Button(text="Hello,kivy")
    TestApp().run()

    输出结果:

    [INFO   ] [Logger      ] Record log in C:Usersusth1.kivylogskivy_17-06-09_17.txt
    [INFO   ] [Kivy        ] v1.10.0
    [INFO   ] [Python      ] v3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
    [INFO   ] [Factory     ] 194 symbols loaded
    [INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil, img_gif (img_sdl2, img_ffpyplayer ignored)
    [INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
    [CRITICAL] [Window      ] Unable to find any valuable Window provider.
    sdl2 - ImportError: DLL load failed: 找不到指定的模块。
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 59, in core_select_lib
        fromlist=[modulename], level=0)
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 26, in <module>
        from kivy.core.window._window_sdl2 import _WindowSDL2Storage
    
    [CRITICAL] [App         ] Unable to get a Window, abort.
     Exception ignored in: 'kivy.properties.dpi2px'
     Traceback (most recent call last):
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivyutils.py", line 496, in __get__
         retval = self.func(inst)
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivymetrics.py", line 174, in dpi
         EventLoop.ensure_window()
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivyase.py", line 127, in ensure_window
         sys.exit(1)
     SystemExit: 1
    [CRITICAL] [App         ] Unable to get a Window, abort.
    
    
    ------------------
    (program exited with code: 1)
    
    请按任意键继续. . .

    接着我在GitHub上查询了相关文档:

    https://github.com/kivy/kivy/issues/3889 
    下载了kivy.deps.sdl2: 
    C:Usersusth1>pip install kivy.deps.sdl2

    输出结果:

    [INFO   ] [Logger      ] Record log in C:Usersusth1.kivylogskivy_17-06-09_16.txt
    [INFO   ] [Kivy        ] v1.10.0
    [INFO   ] [Python      ] v3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
    [INFO   ] [Factory     ] 194 symbols loaded
    [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
    [INFO   ] [Text        ] Provider: sdl2
    [INFO   ] [OSC         ] using <thread> for socket
    [INFO   ] [Window      ] Provider: sdl2
    [CRITICAL] [Window      ] Unable to find any valuable Window provider.
    sdl2 - ImportError: DLL load failed: 找不到指定的模块。
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 67, in core_select_lib
        cls = cls()
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 140, in __init__
        super(WindowSDL, self).__init__()
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindow\__init__.py", line 899, in __init__
        self.create_window()
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 269, in create_window
        self.fullscreen, resizable, state)
      File "kivycorewindow\_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivycore/window\_window_sdl2.c:2466)
      File "kivygraphicscgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name (kivygraphicscgl.c:3044)
      File "kivygraphicscgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name (kivygraphicscgl.c:2879)
      File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libimportlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 978, in _gcd_import
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 560, in module_from_spec
      File "<frozen importlib._bootstrap_external>", line 922, in create_module
      File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
    
    [CRITICAL] [App         ] Unable to get a Window, abort.
     Exception ignored in: 'kivy.properties.dpi2px'
     Traceback (most recent call last):
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivyutils.py", line 496, in __get__
         retval = self.func(inst)
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivymetrics.py", line 174, in dpi
         EventLoop.ensure_window()
       File "C:Usersusth1AppDataLocalProgramsPythonPython36-32libsite-packageskivyase.py", line 127, in ensure_window
         sys.exit(1)
     SystemExit: 1
    [CRITICAL] [App         ] Unable to get a Window, abort.
    
    
    ------------------
    (program exited with code: 1)
    
    请按任意键继续. . .

    成功!

    原链接 https://blog.csdn.net/qq_36751365/article/details/72955956

  • 相关阅读:
    jquery实现瀑布文字
    文本域、bootstrap-table显示以及MySQL三者间的换行符问题
    Mybatis框架的搭建和基本使用方法
    解决ajax多次绑定问题
    浅析JSONP与CROS技术解决跨域问题
    使用Ajax+nodejs实现页面头像上传功能
    自写滚屏组件
    express框架的ejs模板引擎渲染html页面
    自写轮播组件
    mousewheel事件细节
  • 原文地址:https://www.cnblogs.com/wudeng/p/9037489.html
Copyright © 2011-2022 走看看