from kivy.app import Appfrom kivy.uix.button import Buttonclass TestApp(App): def build(self): return Button(text="Hello,kivy")TestApp().run()
Output Result:
[INFO][Logger] Record Log in C:\users\usth1\.kivy\logs\kivy_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 + 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: The specified module could not be found. File "C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\__init__.py ", line-core_select_lib, in-fromlist=[ModuleName], level=0) File "C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\window\window_sdl2.py ", line +, 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:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\utils.py ", line 496, in __get__ retval = Self.func (inst) File" C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\metrics.py ", line 174, in DPI Eventloop.ensure_window () File" C:\ Users\usth1\appdata\Local< Span class= "Hljs-command" >\programs\python\Python36-32< Span class= "Hljs-command" >\lib\site-packages\kivy\base.py ", line 127, in Ensure_window sys.exit (1) systemexit:1[ Critical [app ] Unable to get a Window, abort.------------------(Program exited with code:1) Press any key to continue ...
Then I queried the relevant documentation on GitHub:
https://github.com/kivy/kivy/issues/3889
Download the KIVY.DEPS.SDL2:
C:\users\usth1>pip Install KIVY.DEPS.SDL2
Output Result:
[INFO][Logger] Record Log in C:\users\usth1\.kivy\logs\kivy_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 + 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 sockets[INFO][Window] Provider:sdl2[CRITICAL][Window] Unable to find any valuable Window Provider.sdl2-importerror:dll load failed: The specified module could not be found. File "C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\__init__.py ", line, Core_select_lib cls = CLS () File" C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\window\window_sdl2.py ", line-in-__init__ super (windowsdl, self). __init__ () File" C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\window\__init__.py ", line 899, in __init__ Self.create_window () File" C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\core\window\window_sdl2.py ", line 269, in Create_window Self.fullscreen, resizable, state) File" Kivy\core\window\_window_sdl2.pyx ", line +, in Kivy.core.window._window_sdl2._windowsdl2storage.setup_window (Kivy\core/window\_window_sdl2.c:2466) File "Kivy\graphics\cgl.pyx ", line-in Kivy.graphics.cgl.cgl_get_backend_name (Kivy\graphics\cgl.c:3044) File "Kivy\graphics\cgl.pyx ", Line Kivy.graphics.cgl.cgl_get_backend_name (Kivy\graphics\cgl.c:2879) File "C:\users\usth1\appdata\local\programs\python\python36-32\lib\importlib\__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._bootst Rap> ", line 961, in _find_and_load File" <frozen importlib._bootstrap> ", line 950, in _find_and_load_unlocked Fil E "<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 Imp Ortlib._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:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\utils.py ", line 496, in __get__ retval = Self.func (inst) File" C:\users\usth1\appdata\local\programs\python\python36-32\lib\site-packages\kivy\metrics.py ", line 174, in DPI Eventloop.ensure_window () File" C:\ Users\usth1\appdata\Local< Span class= "Hljs-command" >\programs\python\Python36-32< Span class= "Hljs-command" >\lib\site-packages\kivy\base.py ", line 127, in Ensure_window sys.exit (1) systemexit:1[ Critical [app ] Unable to get a Window, abort.------------------(Program exited with code:1) Press any key to continue ...
Success!
Original link 72955956
Reprint an article Python program used on Android phone