''' Based on https://stackoverflow.com/questions/17915440/python-tkinter-save-canvas-as-image-using-pil Simple scribble program ''' try: # Python 3 import tkinter except ImportError: # Python 2 import Tkinter tkinter = Tkinter def ImageGenerator(parent): global b1 b1 = "up" drawing_area=tkinter.Canvas(parent,width=250,height=200) drawing_area.pack() drawing_area.bind("", motion) drawing_area.bind("", b1down) drawing_area.bind("", b1up) def b1down(event): global b1 b1 = "down" def b1up(event): global b1 b1 = "up" def motion(event): global b1, xold, yold if b1 == "down": event.widget.create_line(xold,yold,event.x,event.y,width=3,fill='blue') xold = event.x yold = event.y if __name__ == "__main__": root=tkinter.Tk() root.wm_title("Image Demo") root.config(bg='white') ImageGenerator(root) root.mainloop()