TKinter error in Programming Remote Control P4


#1

In running the following code

import tkinter as tk
from gopigo import *

def key_input(event):
key_press = event.keysym.lower()
print(key_press)

command = tk.Tk()
command.bind_all(’’, key_input)
command.mainloop()

I get this error

:Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type “copyright”, “credits” or “license()” for more information.

================================ RESTART ================================

Traceback (most recent call last):
File “/home/pi/Desktop/GoPiGoLocal/t4a.py”, line 9, in
command.bind_all(’’, key_input)
File “/usr/lib/python3.4/tkinter/init.py”, line 1103, in bind_all
return self._bind((‘bind’, ‘all’), sequence, func, add, 0)
File “/usr/lib/python3.4/tkinter/init.py”, line 1046, in _bind
self.tk.call(what + (sequence, cmd))
_tkinter.TclError: no events specified in binding


#2

This is an error with tkinter, not the robot. I’d reccommend going to the Raspberry Pi forums.
https://www.raspberrypi.org/forums/


#4

if u dont have solver it yet so on the last rows u need to do this instead
command = tk.Tk()
command.bind_all("< Key >", key_input)
command.mainloop()

no spaces between < > and Key