0

So i have this gridLayout containing only custom buttons that are handled in a specific class. I want that when i click on a button in the gridLayout, another button still in the same gridLayout parent changes it's background_normal property. It there something like this?

self.parent[otherButtonCol, otherButtonRow].background_normal = 'image.png'
Baz
  • 143
  • 3
  • 9

1 Answers1

0

Below is just a simple example for illustration.

Example

main.py

from kivy.app import App
from kivy.uix.gridlayout import GridLayout


class MyWidget(GridLayout):
    pass


class TestApp(App):
    def build(self):
        return MyWidget()


if __name__ == "__main__":
    TestApp().run()

test.kv

#:kivy 1.10.0

<MyBigButt@Button>:
    text_size: self.size
    font_size: "25sp"
    markup: True

<MyWidget>:
    cols: 1
    MyBigButt:
        text: "Change Other Button Background Normal Property"
        on_release: root.ids.btn2.background_normal = "kivymd_logo.png"
    MyBigButt:
        id: btn2

Output

Second Button Background Normal Property Changed

ikolim
  • 15,721
  • 2
  • 19
  • 29