Last active
March 27, 2019 12:05
-
-
Save el3/709f431e6518fc9e29c91dbc6f54c9a6 to your computer and use it in GitHub Desktop.
Kivy checkbox (radiobutton). How to make radiobuttons persistent (not deselect if pressed on when active)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.lang import Builder | |
from kivy.uix.checkbox import CheckBox | |
class CB(CheckBox): | |
def on_touch_down(self, *args): | |
if self.active: | |
return | |
super(CB, self).on_touch_down(*args) | |
KV = """ | |
BoxLayout: | |
orientation: "vertical" | |
CB: | |
group: "one" | |
CB: | |
group: "one" | |
CB: | |
group: "one" | |
""" | |
class MyApp(App): | |
def build(self): | |
return Builder.load_string(KV) | |
MyApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment