Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- """
- import tkinter as tk
- root = tk.Tk()
- k=30
- W=22*k
- H=4*k
- sh0y=20
- sh0x=H/2
- def lineAB(a,b,shx, sh0y, k):
- canvas.create_line(a[0]*k+shx*4*k+sh0y,sh0x-a[1]*k,
- b[0]*k+shx*4*k+sh0y, sh0x-b[1]*k,
- width=3, capstyle=tk.ROUND)
- def arcAB(a,b,shx, sh0y, k):
- R = ((b[0] - a[0]) / 2)*k
- canvas.create_arc(a[0]*k+shx*4*k+sh0y, sh0x-R,
- b[0]*k+shx*4*k+sh0y, sh0x+R,
- start=180, extent=-180, style=tk.ARC,
- width=3)
- canvas = tk.Canvas(root, width=W, height=H,bg='white')
- canvas.pack()
- # Horizontal line
- i=1
- while sh0x+i*k < H:
- canvas.create_line(0,sh0x+i*k, W, sh0x+i*k, fill='cyan')
- canvas.create_line(0,sh0x-i*k, W, sh0x-i*k, fill='cyan')
- i += 1
- # Vertical line
- i=1
- while sh0y+i*k < W:
- canvas.create_line(sh0y+i*k,0, sh0y+i*k, W, fill='cyan')
- i += 1
- canvas.create_line(0,sh0x, W, sh0x, fill='gray', arrow=tk.LAST)#0x
- canvas.create_line(sh0y,H, sh0y, 0, fill='gray', arrow=tk.LAST)#0y
- xy = [[0,-1], [1,0], [3,0], [3,-1], [4,-1]]
- for i in range(5):
- lineAB(xy[0], xy[1], i, sh0y, k)
- arcAB(xy[1], xy[2], i, sh0y, k)
- lineAB(xy[2], xy[3], i, sh0y, k)
- lineAB(xy[3], xy[4], i, sh0y, k)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement