切换屏幕时出现Kivy标签视觉故障

时间:2019-07-16 05:16:26

标签: python kivy

我正在用Kivy开发一个简单的基本事实数学应用程序。我正在使用ScreenManager在不同的屏幕之间切换。当我在屏幕之间切换时,每页顶部的标签都出现了令人讨厌的视觉故障。

enter image description here

我尝试为每个标签设置ID,但是它什么也没做。我对kivy很陌生,所以不知道我在做什么。

该程序有2个文件: main.kv

Manager:
    MainMenu:
    GameMode:
    DifficultyScreen:
    Game:
<MainMenu>:
    name: "menu"

    GridLayout:
        rows: 2

        Label:
            text: "More On Maths"
            id: home_title
        Button:
            text: "Play"
            on_release:
                app.root.current = "gamemode_screen"
<GameMode>:
    name: "gamemode_screen"

    GridLayout:
        rows: 5

        Label:
            text: "Select Game Mode"
            id: gamemode_select
        Button:
            text: "Addition"
            on_press: root.btn_add()
            on_release:
                app.root.current = "difficulty_screen"

main.py

import kivy
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen

class MainMenu(Screen):
    pass
class GameMode(Screen):
    pass
class DifficultyScreen(Screen):
    pass
class Game(Screen):
    pass
class Manager(ScreenManager):
    pass

class Main(App):
    def build(self):
        return

if __name__ == "__main__":
    Main().run()

有人遇到过吗?知道如何解决吗?

谢谢

0 个答案:

没有答案