import tkinter as tki class MyApp: def __init__(self,parent): self._parent = parent # add a canvas to draw on self._canvas = tki.Canvas(parent, width=200, height=200, highlightbackground='black') self._canvas.pack() # bind an event to the entry into the canvas self._canvas.bind("", self._enter_event_handler) self._canvas.bind("", lambda event: self._canvas.config(highlightbackground="black")) def _enter_event_handler(self,event): self._canvas.config(highlightbackground="red") root = tki.Tk() MyApp(root) root.mainloop()