简体   繁体   English

Kivy scatterLayout恢复为原始大小

[英]Kivy scatterLayout revert to original size

My apologies if this is a dumb question. 如果这是一个愚蠢的问题,我表示歉意。

I am trying to make a zoom-able interface but I want it to reset it's self after a while. 我正在尝试制作一个可缩放的界面,但我希望它在一段时间后重设其自身。 I managed to make it zoom-able using a scatterLayout but I can't get it to revert back to its original size after that, unless the user zooms back out himself. 我设法使用scatterLayout将其缩放为可缩放状态,但此后除非用户自己进行缩小,否则无法将其恢复为原始大小。 Any way to reset my scatterLayout to its original size after I zoom in on it? 在放大后,是否可以将scatterLayout重置为其原始大小?

Found the answer, well an answer. 找到了答案,很好的答案。

I overwrite the on_touch_up event and use the transform ObjectProperty of the Scatter widget with a matrix of 1,1,1 like so 我覆盖了on_touch_up事件,并使用Scatter小部件的transform ObjectProperty和1,1,1矩阵,如下所示

from kivy.graphics.transformation import Matrix
def on_touch_up(self, touch):
trans = Matrix().scale(1, 1, 1)
self.ids['myScat'].transform=trans

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM