I\'ve been porting the code for this assignment: http://www.stanford.edu/class/cs221/progAssignments/PA1/search.html (the entire source code is
It appears Tkinter.tkinter
was changed to tkinter._tkinter
in Python 3. Compare these docs from Python 2 with these from Python 3. Also, dooneevent
is no longer in tkinter._tkinter
, but is still a member of the Tk
(aka root
) object.
So change your code to
def keys_pressed(d_o_e=lambda arg: _root_window.dooneevent(arg),
d_w=tkinter._tkinter.DONT_WAIT):
This takes advantage of the fact that in your linked code _root_window
is global
, so while _root_window
is not available when the class is defined, it will be available when the lambda is run.