如何在 kivy 语言和 python class 中将按钮放在按钮上方

how to put buttons above the button in kivy language and python class

我想将这些按钮放在网格布局中的按钮 (2) 上方,就像 (0,1,2) 使用 python 语言并且不打断我输入的 kivy 语言,我的意思是不要在 kivy 语言中使用 for 循环

from kivy.lang.builder import Builder
from kivy.app import App
from kivy.uix.button import Button

kv=Builder.load_string('''
BoxLayout:
    GridLayout:
        id:grid_button
        cols:1
        Button:
            text:'2'
''')

class Accounting(App):
    def build(self):
        return kv
    def on_start(self):
        for a in range(2):
#I want to put these buttons above the button (2) in grid layout
            self.root.ids.grid_button.add_widget(Button(text=str(a)))

Accounting().run()
from kivy.lang.builder import Builder
from kivy.app import App
from kivy.uix.button import Button

kv=Builder.load_string('''
BoxLayout:
    GridLayout:
        id:grid_button
        cols:1
        Button:
            text:'2'
''')

class Accounting(App):
    def build(self):
        return kv
    def on_start(self):
        for a in range(2):
#I want to put these buttons above the button (2) in grid layout
            self.root.ids.grid_button.add_widget(Button(text=str(a)), index=1)

Accounting().run()