python - How to set a key to close a program -


i'm attempting write own auto-clicker program side-project (i'm new programmer).

and have tried looking how bind key kill program led tkinter , not looking use tkinter (at least right now)

import win32api import win32con import sys  def click(x, y):     win32api.setcursorpos((x, y))     win32api.mouse_event(win32con.mouseeventf_leftdown, x, y, 0, 0)     win32api.mouse_event(win32con.mouseeventf_leftup, x, y, 0,  0)  n in range(100000):     click(100, 450) 

so add in current script can bind let's esc key kill program?