Kivy:.kv 文件中的绑定方法 [英] Kivy: bind method inside the .kv file

查看:27
本文介绍了Kivy:.kv 文件中的绑定方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的 .py 文件中删除这一行:

I would like to delete this line from my .py file:

self.layout.bind(minimum_height=self.layout.setter('height'))

并用相同的指令替换它,但在 .kv 文件中.有没有办法将 self.layout.setter('height') 绑定到 minimum_height ?

and replace it by the same instruction but in the .kv file. Is there any way to bind self.layout.setter('height') to minimum_height ?

推荐答案

怎么样?

height: self.minimum_height

我猜你在 ScrollView 中使用它.如果为真,这应该有效.例如,请参阅这篇文章 https://stackoverflow.com/a/45313388/6646710,它正是使用了它.

I am guessing you use that in a ScrollView. If true this should work. See for example this post https://stackoverflow.com/a/45313388/6646710 which uses exactly that.

这篇关于Kivy:.kv 文件中的绑定方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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