Python 在两个文本输入中添加四个值,并在标签kivy中获得结果

Python 在两个文本输入中添加四个值,并在标签kivy中获得结果,python,label,cursor,kivy,textinput,Python,Label,Cursor,Kivy,Textinput,我正在尝试构建一个可以计算两个Textinput中四个值之和的应用程序。我有以下代码: 有一个文本输入,用户可以在此文本输入中输入一个数字,然后用户可以按“回车”,然后给出第二个文本输入,在第二个文本输入中用户可以输入另一个值, 如果用户按下“空格”,他会得到结果,即第一个值和第二个值的总和 我的代码: main.py main.kv文件: <CustButton@Button>: font_size: 40 <WindowManager>: BestW

我正在尝试构建一个可以计算两个Textinput中四个值之和的应用程序。我有以下代码: 有一个文本输入,用户可以在此文本输入中输入一个数字,然后用户可以按“回车”,然后给出第二个文本输入,在第二个文本输入中用户可以输入另一个值, 如果用户按下“空格”,他会得到结果,即第一个值和第二个值的总和

我的代码: main.py

main.kv文件:

<CustButton@Button>:
    font_size: 40

<WindowManager>:
    BestWindow:


<BestWindow>:

    name: "erst"
    grid: grid.__self__
    GridLayout:
        cols:1
        # you will control that GridLayout from .py so here it's empty
        GridLayout:
            # set the id to be able to control it from .py file
            id: grid
            cols: 2




        GridLayout:
            spacing: 10
            cols:2

            Button:
                id : test3
                focus: False
                text: "Result!"
                on_press: app.root.current = "therd"

            Label:
                id:label_id
                multiline: True
            BoxLayout:
                id: result_layout
                orientation: "horizontal"
:
字体大小:40
:
最佳窗口:
:
名称:“erst”
网格:网格__
网格布局:
科尔斯:1
#您将从.py控制GridLayout,所以这里它是空的
网格布局:
#将id设置为能够从.py文件控制它
id:网格
科尔斯:2
网格布局:
间距:10
科尔斯:2
按钮:
id:test3
焦点:错误
文字:“结果!”
按:app.root.current=“therd”
标签:
id:label\u id
多行:正确
盒子布局:
id:result\u布局
方向:“水平”
现在我要做以下几件事: 1。光标必须在第一个文本输入中2。当我按“Enter”时,光标必须位于新的文本输入中。 3。在每个文本输入中输入多个值,并在值之间使用Komma, e、 g.第一个文本输入:1,3,2第二个文本输入:3,5,3,5结果:4 8 5 5 我怎么做? 多谢各位

<CustButton@Button>:
    font_size: 40

<WindowManager>:
    BestWindow:


<BestWindow>:

    name: "erst"
    grid: grid.__self__
    GridLayout:
        cols:1
        # you will control that GridLayout from .py so here it's empty
        GridLayout:
            # set the id to be able to control it from .py file
            id: grid
            cols: 2




        GridLayout:
            spacing: 10
            cols:2

            Button:
                id : test3
                focus: False
                text: "Result!"
                on_press: app.root.current = "therd"

            Label:
                id:label_id
                multiline: True
            BoxLayout:
                id: result_layout
                orientation: "horizontal"