Q:

How to Keypress the keys A and D on a keyboard in Python

class Paddle:
    def __init__(self, canvas, color):
        self.canvas = canvas
        self.id = canvas.create_rectangle(0, 150, 30, 250, fill = color)
        self.y = 0
        self.started = False
        self.canvas_height = self.canvas.winfo_height()
        self.canvas_width = self.canvas.winfo_width()
        self.canvas.bind_all("<KeyPress-A>", self.turn_left)
        self.canvas.bind_all("<KeyPress-D>", self.turn_right)
        self.canvas.bind_all("<Button-1>", self.start_game)

My code looks something like this. The button-1 Works, but I'm still unsure how to Keypress the A and D keys on the keyboard. The following what I've done doesn't work. 
self.canvas.bind_all("<KeyPress-Left>", self.turn_right)

Something  like this works for the arrow keys. I don't know how to do it for the letters on the keyboard.
Any help appreciated! Thanks!

A:

Have you tried:
self.canvas.bind('<KeyPress-a>', self.turn_right)

If your sequence is '<KeyPress-A>' then you have to press a capital 'A' rather than a little 'a'.

