import tkinter as tk
class FirstFrame(tk.Frame):
def __init__(self, master, **kwargs):
tk.Frame.__init__(self, master, **kwargs)
self.pack()
master.title("Snake")
master.geometry("1000x600")
self.canvas = tk.Canvas(master, width=1000, height=600)
self.canvas.pack()
self.canvas.focus_set()
self.canvas.bind("<Key>", self.create, "+")
def create(self, event):
self.canvas.unbind("<Key>")
self.snake = self.canvas.create_rectangle(0, 0,10,10, fill="yellow")