Make gauge update immediately in 1 jump

This commit is contained in:
PySimpleGUI 2020-11-23 16:43:26 -05:00
parent 1b4c63e15c
commit dac6b73045
2 changed files with 4 additions and 4 deletions

View File

@ -288,8 +288,8 @@ def main(location):
if gauge.change(): if gauge.change():
new_angle = cpu_percent*180/100 new_angle = cpu_percent*180/100
window['-gauge VALUE-'].update(f'{int(cpu_percent)}%') window['-gauge VALUE-'].update(f'{int(cpu_percent)}%')
gauge.change(degree=new_angle, step=new_angle) gauge.change(degree=new_angle, step=180)
gauge.change()
# ----------- update the graphics and text in the window ------------ # ----------- update the graphics and text in the window ------------
# update the window, wait for a while, then check for exit # update the window, wait for a while, then check for exit
event, values = window.read(timeout=UPDATE_FREQUENCY_MILLISECONDS) event, values = window.read(timeout=UPDATE_FREQUENCY_MILLISECONDS)

View File

@ -298,8 +298,8 @@ def main(location):
new_angle = ram_percent*180/100 new_angle = ram_percent*180/100
window['-gauge VALUE-'].update(f'{ram_percent}') window['-gauge VALUE-'].update(f'{ram_percent}')
window['-RAM USED-'].update(f'{human_size(ram.used)}') window['-RAM USED-'].update(f'{human_size(ram.used)}')
gauge.change(degree=new_angle, step=new_angle) gauge.change(degree=new_angle, step=180)
gauge.change()
# ----------- update the graphics and text in the window ------------ # ----------- update the graphics and text in the window ------------
# update the window, wait for a while, then check for exit # update the window, wait for a while, then check for exit