kivy中的表如何在单击字段时更改值

o75abkj4  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(198)

嗨,gyus,请告诉我,当我点击字段时,我如何改变表中的值,这可能吗?
我是说这张table
我的代码,因此我希望在单击时更改单行中的值:

from kivymd.app import MDApp
from kivymd.uix.screen import Screen
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp

from kivy.uix.button import Button

class DemoApp(MDApp):

    def build(self):
        screen = Screen()
        data_table = MDDataTable(pos_hint={'center_x': 0.5, 'center_y': 0.5},
                                 size_hint=(1, 1),
                                 #rows_num=10,
                                 column_data=[
                                     ("field.", dp(50)),
                                     ("field", dp(50)),
                                     ("field", dp(50))

                                 ],
                                 row_data=[
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field"),
                                     ("field", "field", "field")

                                 ]
                                 )

        screen.add_widget(data_table)
        return screen

DemoApp().run()

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题