'kivy doesn't show window
i use this code, and run it on py charm
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text="gw hidup")
if __name__ == "__main__":
MyApp().run()
and this is come out after i run it
[INFO ] [Logger ] Record log in C:\Users\xeryd\.kivy\logs\kivy_20-08-04_7.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\xeryd\PycharmProjects\pythonProject1\venv\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\xeryd\PycharmProjects\pythonProject1\venv\Scripts\python.exe"
[INFO ] [Factory ] 184 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. 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 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\xeryd\PycharmProjects\pythonProject1\venv\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\xeryd\PycharmProjects\pythonProject1\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 27, in <module>
from kivy.core.window._window_sdl2 import _WindowSDL2Storage
[CRITICAL] [App ] Unable to get a Window, abort.
why this come out and what should i do?
Solution 1:[1]
This Solution Might Help You Out On Either OS OSX Or Win
#qpy:kivy
import kivy
kivy.require('1.10.1') # **REPLACE WITH CURRENT KIVY VERSION** To Get Rid Of This error--> [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
from kivy import Config
Config.set('graphics', 'multisamples', '0') # **To Get Rid Of The Open GL 2.0 Error**
Solution 2:[2]
@zidanhadipratama
The Answer to your comment,
# The Other Imports
import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.uix.label import Label
# Make Sure This Is Always the last import
from kivy import Config
Config.set('graphics', 'multisamples', '0')
# Main Code
class MyApp(App):
def build(self):
return Label(text="Hello, World!")
# Run This Thing
if __name__ == "__main__":
MyApp().run()
Solution 3:[3]
Type in your terminal:
pip install msvc-runtime
Then that will work fine.
If you are still in the problem, then uninstall kivy:
pip uninstall kivy
Than again install kivy.
Or you are new kivy, you can checkout kivy documentations - https://kivy.org/doc/stable/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Aryan |
Solution 3 | S.B |