0
import tkinter as tk
import tk_tools

root = tk.Tk()

p = tk_tools.RotaryScale(root, max_value=100.0, unit='psi')
p.grid()

p.set_value(32.7)

root.mainloop()

How I can update this gauge?

I would like the gauge to be Updated

Kassem
  • 1
  • Have a look at this example from the library you are using: https://github.com/slightlynybbled/tk_tools/blob/master/examples/gauge.py – Vincent Dec 17 '22 at 15:42

1 Answers1

0

You can use the after method to schedule an update (tkinter: how to use after method).

If you look at the official examples on GitHub you'll find one for the gauge specifically (https://github.com/slightlynybbled/tk_tools/blob/master/examples/gauge.py). The relevant snippet for updating the gauge looks like this:

import tkinter as tk
import tk_tools

root = tk.Tk()

p = tk_tools.RotaryScale(root, max_value=100.0, unit='psi')
p.grid()

count = 30.0
p.set_value(count)

def update_gauge():
    global p, count
    count += 1.0
    p.set_value(count)
    root.after(50, update_gauge)

root.after(50, update_gauge)
root.mainloop()

This would update the gauge every 50ms and increase its value by 1 each time.

Vincent
  • 482
  • 4
  • 15