![]() |
[Kivy] Not listen for multi clicks - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Kivy] Not listen for multi clicks (/thread-35570.html) |
Not listen for multi clicks - dipbox - Nov-18-2021 Hi, I have Kivy app that sometimes making some heavy stuff. It makes the user to sometimes click/touch two/three times, but I wish to ignore this click. Right now, the clicks "saves" and will be executed after the first click. My goal is to ignore them. Is it possible? example.kv <Upload> name:"upload" BoxLayout: orientation: 'vertical' Label: id: nr_label size_hint: (1, 1) font_size:24 text: "0" Button: size_hint: (1, 1) text: "Increase" on_release: root.increase() class Upload(Screen): nr = 0 def increase(self): self.nr += 1 sleep(1) # Do some heavy stuff self.ids.nr_label.text = str(self.nr)If I run this example the app lock the button in one second, and after that I don't want anything to happen, even if I have click multi times on the button. RE: Not listen for multi clicks - Barrowman - Nov-18-2021 change Quote: def increase(self):to if self.nr == 0: self.nr = 1 self.ids.nr_label.text = str(self.nr) else: return()You seem to be thinking that the sleep will allow something else to be going on but it won't. RE: Not listen for multi clicks - dipbox - Nov-18-2021 (Nov-18-2021, 02:02 PM)Barrowman Wrote: changeQuote: def increase(self):to The row: sleep(1) # Do some heavy stuffis for simulate some slow processes, in my case it's a bluetooth communication that some time takes 1-2 second |