这是我的名为 loginscreen.py 的 py 文件
from kivymd.app import MDApp
class loginscreen(MDApp):
def on_start(self):
loginscreen().run()
这是我的名为 loginscreen.kv 的 kivy 文件:
ScreenManager:
id: screen_manager
Screen:
name: "screen1"
MDLabel:
text: "HOT"
size_hint_y: .5
size_hint_x: None
width: 200
height: self.texture_size[1]
halign: 'center'
Screen:
name: "screen2"
MDLabel:
text: "COLD""
size_hint_y: .5
size_hint_x: None
width: 200
height: self.texture_size[1]
halign: 'center'
这是我的终端输出:
/usr/bin/python3 /Users/loginscreen.py
[INFO ] [Logger ] Record log in /Users/.kivy/logs/kivy_20-07-19_146.txt
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "/Library/Python/3.7/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.7.3 (default, Apr 24 2020, 18:51:23)
[Clang 11.0.3 (clang-1103.0.32.62)]
[INFO ] [Python ] Interpreter at "/Library/Developer/CommandLineTools/usr/bin/python3"
[INFO ] [KivyMD ] v0.104.1
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL ES 2" graphics system
[INFO ] [GL ] Backend used <sdl2>
[INFO ] [GL ] OpenGL version <b'2.1 INTEL-14.5.22'>
[INFO ] [GL ] OpenGL vendor <b'Intel Inc.'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 615'>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <b'1.20'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: sdl2
[INFO ] [GL ] NPOT texture support is available
Process finished with exit code 0
有人可以向我解释为什么我在运行时无法打开 kivy 窗口吗?在我的 main.py 文件中,窗口打开得很好,但不是这个。是什么赋予了?