Why Is My Kivy Program Not Calling The Function From Another Class?
I think this is more of a python question than a kivy question. class Keyboard is sharing a method from class GUI. I created a GUI instance called self.a to connected the 2 classe
Solution 1:
I think it works fine but in another object that you can't see. The problem is that you show one object of GUI class on screen. And for the Keyboard class you have created another object that you can't see. So the solution is to use one object of GUI class and operate with it in both of MainApp and Keyboard classes. Something like:
class MainApp(App):
def build(self):
# here we create an object...
self.gui = GUI()
# ...send it to Keyboard class
key = Keyboard(self.gui)
# and return it
return self.gui
class Keyboard(Widget):
def __init__(self, gui):
super().__init__()
# and here we receive that object instead of creating new one
self.a = gui
Post a Comment for "Why Is My Kivy Program Not Calling The Function From Another Class?"