无法找到TableRecycleGridLayout来修复Kivy代码 [英] Unable to find TableRecycleGridLayout to fix Kivy code

查看:136
本文介绍了无法找到TableRecycleGridLayout来修复Kivy代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在KivyMD中创建表时出现错误

I'm getting an error trying to create a table in KivyMD

ValueError: TableRecycleGridLayout.orientation is set to an invalid option 'vertical'. Must be one of: ['lr-tb', 'tb-lr', 'rl-tb', 'tb-rl', 'lr-bt', 'bt-lr', 'rl-bt', 'bt-rl']

这是在告诉我我需要将方向更改为垂直"以外的其他位置,但是我在任何地方都找不到.

It's telling me I need to change orientation to something other than 'vertical' but I can't find it anywhere.

推荐答案

在MDDataTable中,您只需要添加"orientation =" lr-tb"即可.或给定的其他值之一.这适用于Kivy == 2.0.0.

In the MDDataTable you just need to add "orientation="lr-tb" or one of the other values the give. This worked for me with Kivy==2.0.0.

示例:

table = MDDataTable(orientation="lr-tb",
                    pos_hint={'center_x': 0.5, 'center_y': 0.5},
                    size_hint=(0.9, 0.6),
                    column_data=[("Food", dp(30)),("Calories", dp(30))],
                    row_data=[("Burger", "300"),("Oats", "50")])

这篇关于无法找到TableRecycleGridLayout来修复Kivy代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆