Feb-29-2020, 07:44 PM
How do I reference a method in my BoxLayout class from my App class?
When I press Page Down, I get this error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
class ConjugationGame(BoxLayout): round = 1 game_state = 0 def change_game_state( self ): if self .game_state > 4 : self .game_state = = 1 else : self .game_state + = 1 class ConjugationApp(App): def build( self ): Window.bind(on_key_down = self .key_down) return ConjugationGame() def key_down( self , key, scancode = None , * _): if scancode = = 281 : # PAGE_DOWN print ( "PAGE_DOWN pressed" ) ConjugationGame.change_game_state() |
Quote:TypeError: change_game_state() missing 1 required positional argument: 'self'