Advertisement
here2share

# Tk_circle_changer.py

Apr 15th, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. # Tk_circle_changer.py
  2.  
  3. import Tkinter
  4.  
  5. root = Tkinter.Tk()
  6.  
  7. ypos_intvar = Tkinter.IntVar()
  8. ypos_intvar.set(100)
  9.  
  10. def y_changed(new_intval):
  11.     canvas.coords(circle_item, 100, 20 + int(new_intval), 200, 120 + int(new_intval))
  12.  
  13. y_slider = Tkinter.Scale(root, from_=1, to=150, variable=ypos_intvar,    
  14.                               label='Y-Position', command=y_changed)
  15. y_slider.grid(row=1, column=0, sticky=Tkinter.W)
  16.  
  17. text = Tkinter.Label(root, text=' Drag Slider To Adjust Circle')
  18. text.grid(row=0, column=0)
  19.  
  20. canvas = Tkinter.Canvas(root, width=300, height=300, background='#FFFFFF')
  21. canvas.grid(row=0, rowspan=2, column=1)
  22.  
  23. circle_item = canvas.create_oval(150, 150, 150, 150,
  24.                                  outline='#000000', fill='#00FFFF')
  25. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement