Cleaned up 4 "rainmeter" demos. Removed exit button, added standard right click exit, edit, versions. Made drive status handle drives being added / removed, all now automatically save their last location for next time they start, version info window pops up on top of window at current location
This commit is contained in:
parent
628ab61f28
commit
12973c4dcc
|
@ -15,7 +15,7 @@ import psutil
|
||||||
Grab anywhere, making window easy to move around
|
Grab anywhere, making window easy to move around
|
||||||
Note that the keys are tuples, with a tuple as the second item
|
Note that the keys are tuples, with a tuple as the second item
|
||||||
('-KEY-', (row, col))
|
('-KEY-', (row, col))
|
||||||
Copyright 2020 PySimpleGUI
|
Copyright 2020, 2022 PySimpleGUI
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GRAPH_WIDTH = 120 # each individual graph size in pixels
|
GRAPH_WIDTH = 120 # each individual graph size in pixels
|
||||||
|
@ -65,8 +65,7 @@ def main(location):
|
||||||
|
|
||||||
sg.theme('Black')
|
sg.theme('Black')
|
||||||
|
|
||||||
layout = [[ sg.Text(sg.SYMBOL_X, enable_events=True, key='Exit', tooltip='Closes window'),
|
layout = [[sg.Text('CPU Core Usage', justification='c', expand_x=True)] ]
|
||||||
sg.Text(' CPU Core Usage')] ]
|
|
||||||
|
|
||||||
# add on the graphs
|
# add on the graphs
|
||||||
for rows in range(num_cores//NUM_COLS+1):
|
for rows in range(num_cores//NUM_COLS+1):
|
||||||
|
@ -86,7 +85,8 @@ def main(location):
|
||||||
element_padding=(0,0),
|
element_padding=(0,0),
|
||||||
border_depth=0,
|
border_depth=0,
|
||||||
location=location,
|
location=location,
|
||||||
right_click_menu=[[''], ['Edit Me', 'Exit',]])
|
enable_close_attempted_event=True,
|
||||||
|
right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_EXIT)
|
||||||
|
|
||||||
|
|
||||||
graphs = []
|
graphs = []
|
||||||
|
@ -101,10 +101,15 @@ def main(location):
|
||||||
while True :
|
while True :
|
||||||
# --------- Read and update window once every Polling Frequency --------
|
# --------- Read and update window once every Polling Frequency --------
|
||||||
event, values = window.read(timeout=POLL_FREQUENCY)
|
event, values = window.read(timeout=POLL_FREQUENCY)
|
||||||
if event in (sg.WIN_CLOSED, 'Exit'): # Be nice and give an exit
|
if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit'): # Be nice and give an exit
|
||||||
|
sg.user_settings_set_entry('-location-', window.current_location()) # save window location before exiting
|
||||||
|
break
|
||||||
|
elif event == sg.WIN_CLOSED:
|
||||||
break
|
break
|
||||||
elif event == 'Edit Me':
|
elif event == 'Edit Me':
|
||||||
sg.execute_editor(__file__)
|
sg.execute_editor(__file__)
|
||||||
|
elif event == 'Version':
|
||||||
|
sg.popup_scrolled(__file__, sg.get_versions(), keep_on_top=True, location=window.current_location())
|
||||||
# read CPU for each core
|
# read CPU for each core
|
||||||
stats = psutil.cpu_percent(percpu=True)
|
stats = psutil.cpu_percent(percpu=True)
|
||||||
|
|
||||||
|
@ -121,5 +126,6 @@ if __name__ == "__main__":
|
||||||
location = sys.argv[1].split(',')
|
location = sys.argv[1].split(',')
|
||||||
location = (int(location[0]), int(location[1]))
|
location = (int(location[0]), int(location[1]))
|
||||||
else:
|
else:
|
||||||
location = (None, None)
|
location = sg.user_settings_get_entry('-location-', (None, None))
|
||||||
|
|
||||||
main(location)
|
main(location)
|
|
@ -34,11 +34,11 @@ def main():
|
||||||
# ---------------- Create Form ----------------
|
# ---------------- Create Form ----------------
|
||||||
sg.theme('Black')
|
sg.theme('Black')
|
||||||
|
|
||||||
layout = [[sg.Text(font=('Helvetica', 20), text_color=sg.YELLOWS[0], key='-CPU PERCENT-'), sg.Push(), sg.Text(sg.SYMBOL_X, enable_events=True, key='Exit')],
|
layout = [[sg.Text(font=('Helvetica', 20), text_color=sg.YELLOWS[0], key='-CPU PERCENT-')],
|
||||||
[sg.Text(size=(35, 12), font=('Courier New', 12), key='-PROCESSES-')], # size will determine how many processes shown
|
[sg.Text(size=(35, 12), font=('Courier New', 12), key='-PROCESSES-')], # size will determine how many processes shown
|
||||||
[sg.Text('Update every '), sg.Spin([x+1 for x in range(10)], 3, key='spin'), sg.T('seconds')]]
|
[sg.Text('Update every '), sg.Spin([x+1 for x in range(10)], 3, key='-SPIN-'), sg.T('seconds')]]
|
||||||
|
|
||||||
window = sg.Window('Top CPU Processes', layout, no_titlebar=True, keep_on_top=True,location=location, use_default_focus=False, alpha_channel=.8, grab_anywhere=True, right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_EXIT, enable_close_attempted_event=True)
|
window = sg.Window('Top CPU Processes', layout, no_titlebar=True, keep_on_top=True,location=location, use_default_focus=False, alpha_channel=.8, grab_anywhere=True, right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_EXIT, enable_close_attempted_event=True)
|
||||||
|
|
||||||
# start cpu measurement thread
|
# start cpu measurement thread
|
||||||
# using the PySimpleGUI call to start and manage the thread
|
# using the PySimpleGUI call to start and manage the thread
|
||||||
|
@ -48,14 +48,17 @@ def main():
|
||||||
while True:
|
while True:
|
||||||
# --------- Read and update window --------
|
# --------- Read and update window --------
|
||||||
event, values = window.read()
|
event, values = window.read()
|
||||||
|
# print(event, values)
|
||||||
# --------- Do Button Operations --------
|
# --------- Do Button Operations --------
|
||||||
if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit'):
|
if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit'):
|
||||||
sg.user_settings_set_entry('-location-', window.current_location()) # save window location before exiting
|
sg.user_settings_set_entry('-location-', window.current_location()) # save window location before exiting
|
||||||
break
|
break
|
||||||
elif event == 'Edit Me':
|
if event == 'Edit Me':
|
||||||
sg.execute_editor(__file__)
|
sp = sg.execute_editor(__file__)
|
||||||
|
elif event == 'Version':
|
||||||
|
sg.popup_scrolled(__file__, sg.get_versions(), keep_on_top=True, location=window.current_location())
|
||||||
elif event == '-CPU UPDATE FROM THREAD-': # indicates data from the thread has arrived
|
elif event == '-CPU UPDATE FROM THREAD-': # indicates data from the thread has arrived
|
||||||
cpu_percent, procs = values[event] # the thread sends a tuple
|
cpu_percent, procs = values[event] # the thread sends a tuple
|
||||||
if procs:
|
if procs:
|
||||||
# --------- Create dictionary of top % CPU processes. Format is name:cpu_percent --------
|
# --------- Create dictionary of top % CPU processes. Format is name:cpu_percent --------
|
||||||
top = {proc.name(): proc.cpu_percent() for proc in procs}
|
top = {proc.name(): proc.cpu_percent() for proc in procs}
|
||||||
|
@ -68,7 +71,7 @@ def main():
|
||||||
window['-CPU PERCENT-'].update(f'CPU {cpu_percent}')
|
window['-CPU PERCENT-'].update(f'CPU {cpu_percent}')
|
||||||
window['-PROCESSES-'].update(display_string)
|
window['-PROCESSES-'].update(display_string)
|
||||||
# get the timeout from the spinner
|
# get the timeout from the spinner
|
||||||
g_interval = int(values['spin'])
|
g_interval = int(values['-SPIN-'])
|
||||||
|
|
||||||
window.close()
|
window.close()
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
||||||
Desktop "Rainmeter" style widget - Drive usage
|
Desktop "Rainmeter" style widget - Drive usage
|
||||||
Requires: psutil
|
Requires: psutil
|
||||||
Shows a bar graph of space used for each drive partician that psutil finds
|
Shows a bar graph of space used for each drive partician that psutil finds
|
||||||
|
Copyright 2022 PySimpleGUI
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ALPHA = 0.7
|
ALPHA = 0.7
|
||||||
|
@ -16,13 +17,21 @@ UPDATE_FREQUENCY_MILLISECONDS = 20 * 1000
|
||||||
BAR_COLORS = ('#23a0a0', '#56d856', '#be45be', '#5681d8', '#d34545', '#BE7C29')
|
BAR_COLORS = ('#23a0a0', '#56d856', '#be45be', '#5681d8', '#d34545', '#BE7C29')
|
||||||
|
|
||||||
|
|
||||||
|
class Globals():
|
||||||
|
drive_list = None
|
||||||
|
def __init__(self):
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def human_size(bytes, units=(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB')):
|
def human_size(bytes, units=(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB')):
|
||||||
""" Returns a human readable string reprentation of bytes"""
|
""" Returns a human readable string reprentation of bytes"""
|
||||||
return str(bytes) + ' ' + units[0] if bytes < 1024 else human_size(bytes >> 10, units[1:])
|
return str(bytes) + ' ' + units[0] if bytes < 1024 else human_size(bytes >> 10, units[1:])
|
||||||
|
|
||||||
|
|
||||||
def update_window(window):
|
def update_window(window):
|
||||||
|
drive_list = []
|
||||||
particians = psutil.disk_partitions()
|
particians = psutil.disk_partitions()
|
||||||
|
all_ok = True
|
||||||
for count, part in enumerate(particians):
|
for count, part in enumerate(particians):
|
||||||
mount = part[0]
|
mount = part[0]
|
||||||
try:
|
try:
|
||||||
|
@ -31,15 +40,19 @@ def update_window(window):
|
||||||
window[('-PROG-', mount)].update_bar(int(usage.percent))
|
window[('-PROG-', mount)].update_bar(int(usage.percent))
|
||||||
window[('-%-', mount)].update(f'{usage.percent}%')
|
window[('-%-', mount)].update(f'{usage.percent}%')
|
||||||
window[('-STATS-', mount)].update(f'{human_size(usage.used)} / {human_size(usage.total)} = {human_size(usage.free)} free')
|
window[('-STATS-', mount)].update(f'{human_size(usage.used)} / {human_size(usage.total)} = {human_size(usage.free)} free')
|
||||||
except:
|
drive_list.append(str(mount))
|
||||||
|
except KeyError as e: # A key error means a new drive was added
|
||||||
|
all_ok = False
|
||||||
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
all_ok = Globals.drive_list == drive_list and all_ok
|
||||||
|
Globals.drive_list = drive_list
|
||||||
|
|
||||||
|
return all_ok
|
||||||
|
|
||||||
def main(location):
|
|
||||||
sg.theme(THEME)
|
|
||||||
|
|
||||||
# ---------------- Create Layout ----------------
|
# ---------------- Create Layout ----------------
|
||||||
|
def create_window(location):
|
||||||
layout = [[sg.Text('Drive Status', font='Any 16')]]
|
layout = [[sg.Text('Drive Status', font='Any 16')]]
|
||||||
|
|
||||||
# Add a row for every partician that has a bar graph and text stats
|
# Add a row for every partician that has a bar graph and text stats
|
||||||
|
@ -56,20 +69,48 @@ def main(location):
|
||||||
sg.Text(f'{usage.percent}%', size=(6, 1), key=('-%-', mount)), sg.T(stats_info, size=(30, 1), key=('-STATS-', mount))]]
|
sg.Text(f'{usage.percent}%', size=(6, 1), key=('-%-', mount)), sg.T(stats_info, size=(30, 1), key=('-STATS-', mount))]]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
layout += [[sg.Text('Refresh', font='Any 8', key='-REFRESH-', enable_events=True), sg.Text('❎', enable_events=True, key='Exit Text')]]
|
layout += [[sg.Text('Refresh', font='Any 8', key='-REFRESH-', enable_events=True)]]
|
||||||
|
|
||||||
# ---------------- Create Window ----------------
|
# ---------------- Create Window ----------------
|
||||||
window = sg.Window('Drive Status Widget', layout, location=location, keep_on_top=True, grab_anywhere=True, no_titlebar=True, alpha_channel=ALPHA, use_default_focus=False,
|
window = sg.Window('Drive Status Widget', layout, location=location, keep_on_top=True, grab_anywhere=True, no_titlebar=True, alpha_channel=ALPHA, use_default_focus=False,right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_EXIT,
|
||||||
finalize=True)
|
finalize=True, enable_close_attempted_event=True)
|
||||||
|
|
||||||
|
return window
|
||||||
|
|
||||||
|
def main(location):
|
||||||
|
# we rely on a key error to tell us if a drive was added. So.... we don't want pesky popups or other key erros to be shown
|
||||||
|
sg.set_options(suppress_error_popups=True, suppress_raise_key_errors=False, suppress_key_guessing=True)
|
||||||
|
|
||||||
|
sg.theme(THEME)
|
||||||
|
window = create_window(location)
|
||||||
update_window(window) # sets the progress bars
|
update_window(window) # sets the progress bars
|
||||||
|
try:
|
||||||
|
# ---------------- Event Loop ----------------
|
||||||
|
while True:
|
||||||
|
event, values = window.read(timeout=UPDATE_FREQUENCY_MILLISECONDS)
|
||||||
|
if event in (sg.WIN_CLOSED, sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit'):
|
||||||
|
if event != sg.WIN_CLOSED:
|
||||||
|
sg.user_settings_set_entry('-location-', window.current_location()) # The line of code to save the position before exiting
|
||||||
|
break
|
||||||
|
|
||||||
|
if event == 'Edit Me':
|
||||||
|
sp = sg.execute_editor(__file__)
|
||||||
|
elif event == 'Version':
|
||||||
|
sg.popup_scrolled(__file__, sg.get_versions(), keep_on_top=True, location=window.current_location())
|
||||||
|
|
||||||
|
if not update_window(window): # update the window.. if not True then something changed and need to make a new window
|
||||||
|
window.close()
|
||||||
|
window = create_window(location)
|
||||||
|
update_window(window)
|
||||||
|
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
sg.Print('ERROR in event loop', e)
|
||||||
|
sg.popup_error_with_traceback('Crashed', e)
|
||||||
|
|
||||||
|
sg.popup('Check the error!')
|
||||||
|
|
||||||
|
|
||||||
# ---------------- Event Loop ----------------
|
|
||||||
while True:
|
|
||||||
event, values = window.read(timeout=UPDATE_FREQUENCY_MILLISECONDS)
|
|
||||||
if event == sg.WIN_CLOSED or event.startswith('Exit'):
|
|
||||||
break
|
|
||||||
update_window(window)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -77,6 +118,6 @@ if __name__ == '__main__':
|
||||||
location = sys.argv[1].split(',')
|
location = sys.argv[1].split(',')
|
||||||
location = (int(location[0]), int(location[1]))
|
location = (int(location[0]), int(location[1]))
|
||||||
else:
|
else:
|
||||||
location = (None, None)
|
location = sg.user_settings_get_entry('-location-', (None, None))
|
||||||
main(location)
|
main(location)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
import psutil
|
import psutil
|
||||||
import sys
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Desktop floating widget - System status dashboard
|
Desktop floating widget - System status dashboard
|
||||||
|
@ -11,6 +10,7 @@ import sys
|
||||||
CPU Used
|
CPU Used
|
||||||
Mem Used
|
Mem Used
|
||||||
Information is updated once a second and is shown as an area graph that scrolls
|
Information is updated once a second and is shown as an area graph that scrolls
|
||||||
|
Copyright 2022 PySimpleGUI
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GRAPH_WIDTH, GRAPH_HEIGHT = 120, 40 # each individual graph size in pixels
|
GRAPH_WIDTH, GRAPH_HEIGHT = 120, 40 # each individual graph size in pixels
|
||||||
|
@ -53,10 +53,11 @@ def human_size(bytes, units=(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB')):
|
||||||
return str(bytes) + units[0] if bytes < 1024 else human_size(bytes >> 10, units[1:])
|
return str(bytes) + units[0] if bytes < 1024 else human_size(bytes >> 10, units[1:])
|
||||||
|
|
||||||
|
|
||||||
def main(location):
|
def main():
|
||||||
# ---------------- Create Window ----------------
|
# ---------------- Create Window ----------------
|
||||||
sg.theme('Black')
|
sg.theme('Black')
|
||||||
sg.set_options(element_padding=(0, 0), margins=(1, 1), border_width=0)
|
sg.set_options(element_padding=(0, 0), margins=(1, 1), border_width=0)
|
||||||
|
location = sg.user_settings_get_entry('-location-', (None, None))
|
||||||
|
|
||||||
def GraphColumn(name, key):
|
def GraphColumn(name, key):
|
||||||
layout = [
|
layout = [
|
||||||
|
@ -68,10 +69,8 @@ def main(location):
|
||||||
key=key+'GRAPH_')]]
|
key=key+'GRAPH_')]]
|
||||||
return sg.Col(layout, pad=(2, 2))
|
return sg.Col(layout, pad=(2, 2))
|
||||||
|
|
||||||
red_x = b"R0lGODlhEAAQAPeQAIsAAI0AAI4AAI8AAJIAAJUAAJQCApkAAJoAAJ4AAJkJCaAAAKYAAKcAAKcCAKcDA6cGAKgAAKsAAKsCAKwAAK0AAK8AAK4CAK8DAqUJAKULAKwLALAAALEAALIAALMAALMDALQAALUAALYAALcEALoAALsAALsCALwAAL8AALkJAL4NAL8NAKoTAKwbAbEQALMVAL0QAL0RAKsREaodHbkQELMsALg2ALk3ALs+ALE2FbgpKbA1Nbc1Nb44N8AAAMIWAMsvAMUgDMcxAKVABb9NBbVJErFYEq1iMrtoMr5kP8BKAMFLAMxKANBBANFCANJFANFEB9JKAMFcANFZANZcANpfAMJUEMZVEc5hAM5pAMluBdRsANR8AM9YOrdERMpIQs1UVMR5WNt8X8VgYMdlZcxtYtx4YNF/btp9eraNf9qXXNCCZsyLeNSLd8SSecySf82kd9qqc9uBgdyBgd+EhN6JgtSIiNuJieGHhOGLg+GKhOKamty1ste4sNO+ueenp+inp+HHrebGrefKuOPTzejWzera1O7b1vLb2/bl4vTu7fbw7ffx7vnz8f///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAJAALAAAAAAQABAAAAjUACEJHEiwYEEABniQKfNFgQCDkATQwAMokEU+PQgUFDAjjR09e/LUmUNnh8aBCcCgUeRmzBkzie6EeQBAoAAMXuA8ciRGCaJHfXzUMCAQgYooWN48anTokR8dQk4sELggBhQrU9Q8evSHiJQgLCIIfMDCSZUjhbYuQkLFCRAMAiOQGGLE0CNBcZYmaRIDLqQFGF60eTRoSxc5jwjhACFWIAgMLtgUocJFy5orL0IQRHAiQgsbRZYswbEhBIiCCH6EiJAhAwQMKU5DjHCi9gnZEHMTDAgAOw=="
|
|
||||||
layout = [
|
layout = [
|
||||||
[sg.Text('System Status Dashboard'+' '*18),
|
[sg.Text('System Status Dashboard'+' '*18)],
|
||||||
sg.Button('', image_data=red_x, button_color=('black', 'black'), key='Exit', tooltip='Closes window')],
|
|
||||||
[GraphColumn('Net Out', '_NET_OUT_'),
|
[GraphColumn('Net Out', '_NET_OUT_'),
|
||||||
GraphColumn('Net In', '_NET_IN_')],
|
GraphColumn('Net In', '_NET_IN_')],
|
||||||
[GraphColumn('Disk Read', '_DISK_READ_'),
|
[GraphColumn('Disk Read', '_DISK_READ_'),
|
||||||
|
@ -82,8 +81,8 @@ def main(location):
|
||||||
window = sg.Window('PSG System Dashboard', layout,
|
window = sg.Window('PSG System Dashboard', layout,
|
||||||
keep_on_top=True,
|
keep_on_top=True,
|
||||||
grab_anywhere=True, no_titlebar=True,
|
grab_anywhere=True, no_titlebar=True,
|
||||||
return_keyboard_events=True, alpha_channel=ALPHA,
|
return_keyboard_events=True, alpha_channel=ALPHA, enable_close_attempted_event=True,
|
||||||
use_default_focus=False, finalize=True, location=location)
|
use_default_focus=False, finalize=True, location=location,right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_EXIT,)
|
||||||
|
|
||||||
# setup graphs & initial values
|
# setup graphs & initial values
|
||||||
netio = psutil.net_io_counters()
|
netio = psutil.net_io_counters()
|
||||||
|
@ -104,9 +103,14 @@ def main(location):
|
||||||
while True :
|
while True :
|
||||||
# --------- Read and update window once a second--------
|
# --------- Read and update window once a second--------
|
||||||
event, values = window.read(timeout=1000)
|
event, values = window.read(timeout=1000)
|
||||||
# Be nice and give an exit, expecially since there is no titlebar
|
if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit'):
|
||||||
if event in (sg.WIN_CLOSED, 'Exit'):
|
sg.user_settings_set_entry('-location-', window.current_location()) # save window location before exiting
|
||||||
break
|
break
|
||||||
|
elif event == 'Edit Me':
|
||||||
|
sp = sg.execute_editor(__file__)
|
||||||
|
elif event == 'Version':
|
||||||
|
sg.popup_scrolled(__file__, sg.get_versions(), keep_on_top=True, location=window.current_location())
|
||||||
|
|
||||||
# ----- Network Graphs -----
|
# ----- Network Graphs -----
|
||||||
netio = psutil.net_io_counters()
|
netio = psutil.net_io_counters()
|
||||||
write_bytes = net_graph_out.graph_value(netio.bytes_sent)
|
write_bytes = net_graph_out.graph_value(netio.bytes_sent)
|
||||||
|
@ -129,10 +133,5 @@ def main(location):
|
||||||
window['_MEM_TXT_'].update('{}% Memory Used'.format(mem_used))
|
window['_MEM_TXT_'].update('{}% Memory Used'.format(mem_used))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
main()
|
||||||
location = sys.argv[1].split(',')
|
|
||||||
location = (int(location[0]), int(location[1]))
|
|
||||||
else:
|
|
||||||
location = (None, None)
|
|
||||||
main(location)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue