I'm trying to get an MDDataTable object to expand it's column's width according to the size of the screen, but I can't find a way to do it. Here's my code:
from kivy.metrics import dp
from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable
from kivymd.uix.screen import MDScreen
rowdata = [
('1', 'something'),
('2', 'another thing'),
('3', 'a waaaaaaaaaaaaaaaayyyyyyy longer thing')
]
class Test(MDApp):
def build(self):
self.data_tables = MDDataTable(
size_hint=(1, 0.7),
use_pagination=False,
check=False,
rows_num=15,
column_data=[
("#", dp(6)),
("Stuff", dp(45)),
],
row_data=rowdata,
)
screen = MDScreen()
screen.add_widget(self.data_tables)
return screen
if __name__ == '__main__':
Test().run()
I think the answer may be related to dp(45)
, where you define the column's width.
Any ideas?