python中的Kivy测验应用程序,用于在正确答案后添加打印分数

python中的Kivy测验应用程序,用于在正确答案后添加打印分数,python,kivy,Python,Kivy,在此处输入code我想在kivy中的问答游戏的每个正确答案后打印分数。我不知道如何在每个正确答案后打印递增的分数 代码: 类RootWidget(Widget): 通过 类屏幕管理(屏幕管理器): 通过 类主屏幕(屏幕): 通过 另一类屏幕(屏幕): 通过 第二类屏幕(屏幕): label\u text=StringProperty(0) 定义初始(自我,**kwargs): 超级(第二屏幕,自我)。\uuuuuuuuuuuuuuuuu初始(**kwargs) self.count=0 self

在此处输入code
我想在kivy中的问答游戏的每个正确答案后打印分数。我不知道如何在每个正确答案后打印递增的分数

代码:

类RootWidget(Widget):
通过
类屏幕管理(屏幕管理器):
通过
类主屏幕(屏幕):
通过
另一类屏幕(屏幕):
通过
第二类屏幕(屏幕):
label\u text=StringProperty(0)
定义初始(自我,**kwargs):
超级(第二屏幕,自我)。\uuuuuuuuuuuuuuuuu初始(**kwargs)
self.count=0
self.label\u text=str(self.count)
def增量(自身,*参数):
self.count+=1
self.label\u text=str(self.count)
打印(自我标签\文本)
班级成绩1(屏幕):
label\u text=StringProperty(0)
定义初始(自我,**kwargs):
超级(分数1,自我)。\uuuuu初始值(**kwargs)
self.count=0
self.label\u text=str(self.count)
def增量(自身,*参数):
self.count+=1
self.label\u text=str(self.count)
打印(自我标签\文本)
kv文件:

<ThirdScreen>:
    name:'3'
    BoxLayout:
        orientation:"vertical"

        Label:
            text:"Who amongst the follwing had called Rabindranath Tagore as THE GREAT SENTINEL?"
            font_size:20
        Button:
            text:'Abdul Kalam Azad'
            size:30,30
            on_release:app.root.current="4"
        Button:
            text:"Mahatma Gandhi"
            size:30,30
            on_press:root.increment()
            on_release:app.root.current="4"
        Button:
            text:'Dr. Rajendra Prasad'
            size:30,30
            on_release:app.root.current="4"
        Button:
            text:'Subhash Chandra Bose'
            size:30,30
            on_release:app.root.current="4"
<Score1>:
    name:'s'
    BoxLayout:
        orientation:'vertical'
        Label:
            text:root.label_text
        Button:
            text: "Next"

            on_release:app.root.current='3'
            on_release:app.root.current='4'
            on_release:app.root.current='5'
            on_release:app.root.current='6'
            on_release:app.root.current='7'
:
姓名:'3'
盒子布局:
方向:“垂直”
标签:
课文:“在下面的人中,谁把泰戈尔称为伟大的哨兵?”
字体大小:20
按钮:
正文:“阿卜杜勒·卡拉姆·阿扎德”
尺码:30,30
发布时:app.root.current=“4”
按钮:
正文:“圣雄甘地”
尺码:30,30
按下按钮:root.increment()
发布时:app.root.current=“4”
按钮:
文字:“Rajendra Prasad博士”
尺码:30,30
发布时:app.root.current=“4”
按钮:
文字:“Subhash Chandra Bose”
尺码:30,30
发布时:app.root.current=“4”
:
姓名:'s'
盒子布局:
方向:'垂直'
标签:
text:root.label\u text
按钮:
正文:“下一个”
发布时:app.root.current='3'
发布时:app.root.current='4'
发布时:app.root.current='5'
发布时:app.root.current='6'
发布时:app.root.current='7'

如果你的意思是在屏幕上显示分数,你应该使用标签之类的东西,而不是打印。

你必须在页面上创建标签。将您的标签设计为.kv的

Label:
    text: root.current_score
此外,您还需要在.py文件中设置当前的_分数,如:

current_score = NumericProperty(0)
现在,您只需要在.py文件的函数中检查答案并增加或减少分数