【发布时间】:2020-05-13 14:00:05
【问题描述】:
每次尝试创建课程时,我都会收到此错误。无论是在外部文件中并导入还是在同一个文件中。
我得到的错误是一个未填充的 self 参数,但是当我填充它时,它的红色下划线表示错误。我在创建多个程序时遇到了这个错误,因此只创建了函数而没有创建类。这很烦人,阻碍了我的学习进步。在这种情况下,未填充的 self 参数错误出现在“MyApp.run()”行上。现在,下面的代码直接来自 Kivy 官方文档。提前感谢您的支持。
import kivy
kivy.require("1.11.1")
from kivy.app import App
from kivy.uix.label import Label
#from kivy.core.audio import SoundLoader
class MyApp(App):
def build(self):
return Label(text="Hello World!")
if __name__ == '__main__':
MyApp.run()
我收到的错误
[INFO ] [Logger ] Record log in C:\Users\jhowd\.kivy\logs\kivy_20-05-13_45.txt
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\jhowd\PycharmProjects\hungarian_tutor\venv\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\jhowd\PycharmProjects\hungarian_tutor\venv\Scripts\python.exe"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored)
[CRITICAL] [Text ] Unable to find any valuable Text 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\jhowd\PycharmProjects\hungarian_tutor\venv\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\jhowd\PycharmProjects\hungarian_tutor\venv\lib\site-packages\kivy\core\text\text_sdl2.py", line 13, in <module>
from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,
pil - ModuleNotFoundError: No module named 'PIL'
File "C:\Users\jhowd\PycharmProjects\hungarian_tutor\venv\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\jhowd\PycharmProjects\hungarian_tutor\venv\lib\site-packages\kivy\core\text\text_pil.py", line 7, in <module>
from PIL import Image, ImageFont, ImageDraw
[CRITICAL] [App ] Unable to get a Text provider, abort.
Process finished with exit code 1
【问题讨论】:
-
嗨!请向我们提供错误消息,我们必须查看它以猜测发生了什么:)
-
也许这意味着 pycharm 文件在某处损坏。如果此错误对您没有任何意义,请尝试重新安装 IDE。
标签: python python-3.x user-interface kivy