Skip to content

Commit

Permalink
Example of a second rotary scale
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonesAtUpdsys committed Oct 18, 2017
1 parent 8580493 commit 8f82b3a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions examples/rotary_scale.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import tkinter as tk
import tk_tools

from tk_tools.images import rotary_gauge_volt

root = tk.Tk()

p = tk_tools.RotaryScale(root, max_value=100.0, size=100, unit='km/h')
p.grid(row=0, column=0)
p1 = tk_tools.RotaryScale(root, max_value=100.0, size=100, unit='km/h')
p1.grid(row=0, column=0)

p2 = tk_tools.RotaryScale(root, max_value=100.0, size=100, img_data=rotary_gauge_volt)
p2.grid(row=0, column=1)

increment = 1.0
value = 0.0
Expand All @@ -13,18 +18,23 @@
def inc():
global value
value += increment
p.set_value(value)

p1.set_value(value)
p2.set_value(value)


def dec():
global value
value -= increment
p.set_value(value)

p1.set_value(value)
p2.set_value(value)


inc_btn = tk.Button(root, text='increment by {}'.format(increment), command=inc)
inc_btn.grid(row=1, column=0)
inc_btn.grid(row=1, column=0, columnspan=2, sticky='news')

dec_btn = tk.Button(root, text='decrement by {}'.format(increment), command=dec)
dec_btn.grid(row=2, column=0)
dec_btn.grid(row=2, column=0, columnspan=2, sticky='news')

root.mainloop()

0 comments on commit 8f82b3a

Please sign in to comment.