kivymd / KivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
https://kivymd.readthedocs.io
MIT License
2.26k stars 674 forks source link

MDCheckbox with group resizes incorrectly on double click #1732

Open MrHxID opened 2 months ago

MrHxID commented 2 months ago

Description of the Bug

I've found a bug in the way the MDCheckbox gets resized. Take the following example:

from kivymd.app import MDApp
from kivymd.uix.selectioncontrol import MDCheckbox

class MainApp(MDApp):
    def build(self):
        return MDCheckbox(group='test')

if __name__ == '__main__':
    MainApp().run()

Make sure that the MDCheckbox has a non-empty group. The group can also be 'root' or 'child', but not ''. To produce the bug, the checkbox has to be inactive. Then double-click quickly on the checkbox. If timed correctly the box will disappear or will show smaller than usual. To reproduce this issue more easily, you can also set the duration of self.check_anim_in to 1 in the MDCheckbox.__init__ method. If you click on the box while check_anim_in is running then the box will get stuck at the size it is currently at.

Proposed solution

To fix this issue, the easiest way is to put

self.scale_value_x = 1
self.scale_value_y = 1

at the start of the MDCheckbox.on_state method.

Versions