这是我的代码
from kivy.app import App
#kivy.require('1.10.1')
from kivy.uix.label import Label
class SimpleKivy(App): #inherit from App class
def bulid(self):
return Label(text="Hello World")
if __name__=="__main__":
SimpleKivy().run()
我得到的只是一个空白的黑屏。什么都没有打印。这是控制台中的输出。
[INFO ] [Logger ] Record log in C:\Users\<my name>\.kivy\logs\kivy_18-12-11_11.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
[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 ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.5.0 - Build 23.20.16.4973'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <b'4.50 - Build 23.20.16.4973'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Base ] Start application main loop
应该注意,我正在运行spyder(anaconda版本4.5.11)。我已经完成了以下链接中列出的所有灌输步骤,并且说满足了所有这些要求。我已经阅读了其他回复并尝试了其他方法,但似乎没有任何效果。
https://kivy.org/doc/stable/installation/installation-windows.html
答案 0 :(得分:1)
在您的SimpleKivy
应用中,方法应为build
,而不是bulid
。