kivy question (snake) | Sololearn: Learn to code for FREE!


kivy question (snake)

Can someone tht know kivy help me with this code? i dont know how to do the tail and use keyboards events in it

11/14/2018 2:23:48 AM

I Am (Not) Arthur!

6 Answers

New Answer


For adding keyboard events you can just bind a function for on_key_down on the widget. You an do like this inside your widget class: #make sure you import Window from kivy.core.window and request a keyboard. # suppose your keyboard is in self.keyboard then do self.keyboard.bind(on_key_down= self.keydownFunc) #keydownFunc here def keydownFunc(self, keyboard, keycode, text, modifiers): #you can assign action using text but here I'm showing by using keycode #assign job for each keydown if keycode[1] == 'a': #do something elif keycode[1] == 'b': #do something elif keycode[1]== 'up': #something else


PyDan Shashi Ranjan Do u guys know how to do the tail? I will have to create more labels for this , right?


Queen Arthur I'm working with kivy these days but I think, it'll take some time for me to understand the working of your code in order to help you with some specific part.



Some widgets size are small, you can change them


I think you maybe follow this video. It simple and easy to learn Snake game