I am hoping to implement some drag-select functionality to a grid of buttons in a GUI. I want to achieve something similar to a drag selection box on desktop operating systems. One press and drag should be able to toggle a group of toggle buttons of arbitrary size. Can I accomplish this with Kivy?
All I can seem to find is drag and drop functionality or multi-select of buttons by holding the shift key but not the exact functionality I am looking for.
Ideally the app could remember which group of toggle buttons were toggled by which specific drags by the user. Please see my attached image. Thank you in advance, any help is appreciated.
Here is my code so far: main.py
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.togglebutton import ToggleButton
class ButtonGridLayout(GridLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
for i in range(10 * 10):
b = ToggleButton(text = str(i))
self.add_widget(b)
class mainApp(App):
pass
mainApp().run()
main.kv
ButtonGridLayout:
rows: 10
cols: 10