Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,18 +1,23 @@
|
|||
import PySimpleGUI as sg
|
||||
import psutil
|
||||
|
||||
layout = [ [sg.Text('CPU Utilization')] ,
|
||||
[sg.Text('', size=(8,2), font='Helvetica 20', justification='center', key='_text_')],
|
||||
[sg.Exit()]]
|
||||
# Usage of PSG and cpu data
|
||||
|
||||
window = sg.Window('CPU Meter').Layout(layout)
|
||||
layout = [[sg.Text('CPU Utilization')],
|
||||
[sg.Text('', size=(8, 2), font='Helvetica 20',
|
||||
justification='center', key='-text-')],
|
||||
[sg.Exit()]]
|
||||
|
||||
window = sg.Window('CPU Meter', layout)
|
||||
|
||||
while True:
|
||||
button, values = window.ReadNonBlocking()
|
||||
event, values = window.ReadNonBlocking()
|
||||
|
||||
if button == 'Exit' or values is None:
|
||||
if event == 'Exit' or values is None:
|
||||
break
|
||||
|
||||
cpu_percent = psutil.cpu_percent(interval=1)
|
||||
|
||||
window.FindElement('_text_').Update(f'CPU {cpu_percent:02.0f}%')
|
||||
window['-text-'].update(f'CPU {cpu_percent:02.0f}%')
|
||||
|
||||
window.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue