Guest User

Untitled

a guest
Oct 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. class ProgressBar(tk.Canvas):
  2.  
  3. def __init__(self, master):
  4.  
  5. super().__init__(master)
  6.  
  7. self._c=Canvas(master, width=400, height=50)
  8. self._c.pack()
  9.  
  10.  
  11. def update_bar(self, moves):
  12. bar=self._c.create_rectangle(0, 0, 50, 20, fill="purple", width=0)
  13. x0, y0, x1, y1 = self._c.coords(bar)
  14. for i in str(moves):
  15. if x1<=300:
  16. self._c.coords(bar, x0, y0, x1*(20-moves), y1)
  17. print(x1)
  18. elif x1>300:
  19. self._c.coords(bar, x0, y0, 50, y1)
Add Comment
Please, Sign In to add comment