here is a runnable code. when the button is pressed, i would like to call a function which changes the screen. now it seem like the binding is not working.
.py file
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.stacklayout import StackLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.properties import ObjectProperty
from kivy.factory import Factory
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.boxlayout import BoxLayout
import redis
from kivy.graphics import Color
from kivy.uix.widget import Widget
class widgets(Widget):
pass
class ScreenManagement(ScreenManager):
def change_screen(self,*args): #need to understand this
App.get_running_app().root.current = 'choice'
def add_btn(self):
for i in range(10):
self.btn=widgets(id=str(i))
self.btn.ids.time.text=str(i)
self.btn.ids.name.text=str(i)
self.btn.ids.location.text=str(i)
self.btn.ids.message.text=str(i)
#.btn.bind(on_release=partial(self.btn_pressed,
self.btn.id)) # when a user button is pressed call the btn_pressed function
self.btn.bind(on_release=self.change_screen)
self.ids.grid.add_widget(self.btn)
class yourApp(App):
pass
if __name__ == '__main__':
yourApp().run()
.kv file