Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_sketchpad_min.py
- from Tkinter import Tk, Canvas
- def begin(event):
- global oldx, oldy
- oldx, oldy=event.x, event.y
- def draw(event):
- global oldx, oldy, canas
- newx, newy=event.x, event.y
- canvas.create_line (oldx, oldy, newx, newy)
- oldx, oldy=newx, newy
- root=Tk()
- oldx, oldy=0,0
- canvas=Canvas(root, height=2000, width=3000)
- canvas.bind("<Button-1>",begin)
- canvas.bind("<Button1-Motion>",draw)
- canvas.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement