Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import json
  2. from tkinter import *
  3. root = Tk()
  4. root.title('Segmented Line')
  5. cw=300
  6. ch=200
  7. canvas_1 = Canvas(root, width=cw, height=ch, background="black")
  8. canvas_1.grid(row=0,column=1)
  9. with open('sprites.json') as json_file:
  10.     data = json.load(json_file)
  11.     for p in data['sprites']:
  12.         print('Name: ' + p['name'])
  13.         print('')
  14.    
  15.     shape=data['sprites'][0]['shape']
  16.     for i in range(0,len(shape)):
  17.         print(i)
  18.         if i%2!=0:
  19.             shape[i]=(-shape[i])+50
  20.     canvas_1.create_line(shape,fill=data['sprites'][0]['color'])
  21.  
  22. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement