diff --git a/Demo_All_Widgets.py b/DemoPrograms/Demo_All_Widgets.py similarity index 100% rename from Demo_All_Widgets.py rename to DemoPrograms/Demo_All_Widgets.py diff --git a/Demo_Borderless_Window.py b/DemoPrograms/Demo_Borderless_Window.py similarity index 100% rename from Demo_Borderless_Window.py rename to DemoPrograms/Demo_Borderless_Window.py diff --git a/Demo_Button_Click.py b/DemoPrograms/Demo_Button_Click.py similarity index 100% rename from Demo_Button_Click.py rename to DemoPrograms/Demo_Button_Click.py diff --git a/Demo_Button_States.py b/DemoPrograms/Demo_Button_States.py similarity index 100% rename from Demo_Button_States.py rename to DemoPrograms/Demo_Button_States.py diff --git a/Demo_Buttons_Mac.py b/DemoPrograms/Demo_Buttons_Mac.py similarity index 100% rename from Demo_Buttons_Mac.py rename to DemoPrograms/Demo_Buttons_Mac.py diff --git a/Demo_Buttons_Nice_Graphics.py b/DemoPrograms/Demo_Buttons_Nice_Graphics.py similarity index 100% rename from Demo_Buttons_Nice_Graphics.py rename to DemoPrograms/Demo_Buttons_Nice_Graphics.py diff --git a/Demo_Calendar.py b/DemoPrograms/Demo_Calendar.py similarity index 100% rename from Demo_Calendar.py rename to DemoPrograms/Demo_Calendar.py diff --git a/Demo_Canvas.py b/DemoPrograms/Demo_Canvas.py similarity index 100% rename from Demo_Canvas.py rename to DemoPrograms/Demo_Canvas.py diff --git a/Demo_Change_Submits_InputText.py b/DemoPrograms/Demo_Change_Submits_InputText.py similarity index 100% rename from Demo_Change_Submits_InputText.py rename to DemoPrograms/Demo_Change_Submits_InputText.py diff --git a/Demo_Chat.py b/DemoPrograms/Demo_Chat.py similarity index 100% rename from Demo_Chat.py rename to DemoPrograms/Demo_Chat.py diff --git a/Demo_Chat_With_History.py b/DemoPrograms/Demo_Chat_With_History.py similarity index 100% rename from Demo_Chat_With_History.py rename to DemoPrograms/Demo_Chat_With_History.py diff --git a/Demo_Chatterbot.py b/DemoPrograms/Demo_Chatterbot.py similarity index 100% rename from Demo_Chatterbot.py rename to DemoPrograms/Demo_Chatterbot.py diff --git a/Demo_Color.py b/DemoPrograms/Demo_Color.py similarity index 100% rename from Demo_Color.py rename to DemoPrograms/Demo_Color.py diff --git a/Demo_Color_Names.py b/DemoPrograms/Demo_Color_Names.py similarity index 100% rename from Demo_Color_Names.py rename to DemoPrograms/Demo_Color_Names.py diff --git a/Demo_Color_Names_Smaller_List.py b/DemoPrograms/Demo_Color_Names_Smaller_List.py similarity index 100% rename from Demo_Color_Names_Smaller_List.py rename to DemoPrograms/Demo_Color_Names_Smaller_List.py diff --git a/Demo_Columns.py b/DemoPrograms/Demo_Columns.py similarity index 100% rename from Demo_Columns.py rename to DemoPrograms/Demo_Columns.py diff --git a/Demo_Compare_Files.py b/DemoPrograms/Demo_Compare_Files.py similarity index 100% rename from Demo_Compare_Files.py rename to DemoPrograms/Demo_Compare_Files.py diff --git a/Demo_DOC_Viewer_PIL.py b/DemoPrograms/Demo_DOC_Viewer_PIL.py similarity index 100% rename from Demo_DOC_Viewer_PIL.py rename to DemoPrograms/Demo_DOC_Viewer_PIL.py diff --git a/Demo_Design_Pattern_Persistent_Window.py b/DemoPrograms/Demo_Design_Pattern_Persistent_Window.py similarity index 100% rename from Demo_Design_Pattern_Persistent_Window.py rename to DemoPrograms/Demo_Design_Pattern_Persistent_Window.py diff --git a/Demo_Design_Patterns.py b/DemoPrograms/Demo_Design_Patterns.py similarity index 100% rename from Demo_Design_Patterns.py rename to DemoPrograms/Demo_Design_Patterns.py diff --git a/Demo_Desktop_Floating_Toolbar.py b/DemoPrograms/Demo_Desktop_Floating_Toolbar.py similarity index 100% rename from Demo_Desktop_Floating_Toolbar.py rename to DemoPrograms/Demo_Desktop_Floating_Toolbar.py diff --git a/Demo_Desktop_Widget_CPU_Dashboard.py b/DemoPrograms/Demo_Desktop_Widget_CPU_Dashboard.py similarity index 100% rename from Demo_Desktop_Widget_CPU_Dashboard.py rename to DemoPrograms/Demo_Desktop_Widget_CPU_Dashboard.py diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/DemoPrograms/Demo_Desktop_Widget_CPU_Graph.py similarity index 100% rename from Demo_Desktop_Widget_CPU_Graph.py rename to DemoPrograms/Demo_Desktop_Widget_CPU_Graph.py diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/DemoPrograms/Demo_Desktop_Widget_CPU_Utilization.py similarity index 100% rename from Demo_Desktop_Widget_CPU_Utilization.py rename to DemoPrograms/Demo_Desktop_Widget_CPU_Utilization.py diff --git a/Demo_Desktop_Widget_CPU_Utilization_Simple.py b/DemoPrograms/Demo_Desktop_Widget_CPU_Utilization_Simple.py similarity index 100% rename from Demo_Desktop_Widget_CPU_Utilization_Simple.py rename to DemoPrograms/Demo_Desktop_Widget_CPU_Utilization_Simple.py diff --git a/Demo_Desktop_Widget_Email_Notification.py b/DemoPrograms/Demo_Desktop_Widget_Email_Notification.py similarity index 100% rename from Demo_Desktop_Widget_Email_Notification.py rename to DemoPrograms/Demo_Desktop_Widget_Email_Notification.py diff --git a/Demo_Desktop_Widget_Timer.py b/DemoPrograms/Demo_Desktop_Widget_Timer.py similarity index 100% rename from Demo_Desktop_Widget_Timer.py rename to DemoPrograms/Demo_Desktop_Widget_Timer.py diff --git a/Demo_Desktop_Widget_psutil_Dashboard.py b/DemoPrograms/Demo_Desktop_Widget_psutil_Dashboard.py similarity index 100% rename from Demo_Desktop_Widget_psutil_Dashboard.py rename to DemoPrograms/Demo_Desktop_Widget_psutil_Dashboard.py diff --git a/Demo_Disable_Elements.py b/DemoPrograms/Demo_Disable_Elements.py similarity index 100% rename from Demo_Disable_Elements.py rename to DemoPrograms/Demo_Disable_Elements.py diff --git a/Demo_DuplicateFileFinder.py b/DemoPrograms/Demo_DuplicateFileFinder.py similarity index 100% rename from Demo_DuplicateFileFinder.py rename to DemoPrograms/Demo_DuplicateFileFinder.py diff --git a/Demo_EXE_Maker.py b/DemoPrograms/Demo_EXE_Maker.py similarity index 100% rename from Demo_EXE_Maker.py rename to DemoPrograms/Demo_EXE_Maker.py diff --git a/Demo_Fill_Form.py b/DemoPrograms/Demo_Fill_Form.py similarity index 100% rename from Demo_Fill_Form.py rename to DemoPrograms/Demo_Fill_Form.py diff --git a/Demo_Floating_Toolbar.py b/DemoPrograms/Demo_Floating_Toolbar.py similarity index 100% rename from Demo_Floating_Toolbar.py rename to DemoPrograms/Demo_Floating_Toolbar.py diff --git a/Demo_Font_Previewer.py b/DemoPrograms/Demo_Font_Previewer.py similarity index 100% rename from Demo_Font_Previewer.py rename to DemoPrograms/Demo_Font_Previewer.py diff --git a/Demo_Font_Sizer.py b/DemoPrograms/Demo_Font_Sizer.py similarity index 100% rename from Demo_Font_Sizer.py rename to DemoPrograms/Demo_Font_Sizer.py diff --git a/Demo_Font_String.py b/DemoPrograms/Demo_Font_String.py similarity index 100% rename from Demo_Font_String.py rename to DemoPrograms/Demo_Font_String.py diff --git a/Demo_GoodColors.py b/DemoPrograms/Demo_GoodColors.py similarity index 100% rename from Demo_GoodColors.py rename to DemoPrograms/Demo_GoodColors.py diff --git a/Demo_Google_TTS.py b/DemoPrograms/Demo_Google_TTS.py similarity index 100% rename from Demo_Google_TTS.py rename to DemoPrograms/Demo_Google_TTS.py diff --git a/Demo_Graph_Drawing.py b/DemoPrograms/Demo_Graph_Drawing.py similarity index 100% rename from Demo_Graph_Drawing.py rename to DemoPrograms/Demo_Graph_Drawing.py diff --git a/Demo_Graph_Element.py b/DemoPrograms/Demo_Graph_Element.py similarity index 100% rename from Demo_Graph_Element.py rename to DemoPrograms/Demo_Graph_Element.py diff --git a/Demo_Graph_Element_Sine_Wave.py b/DemoPrograms/Demo_Graph_Element_Sine_Wave.py similarity index 100% rename from Demo_Graph_Element_Sine_Wave.py rename to DemoPrograms/Demo_Graph_Element_Sine_Wave.py diff --git a/Demo_Graph_Noise.py b/DemoPrograms/Demo_Graph_Noise.py similarity index 100% rename from Demo_Graph_Noise.py rename to DemoPrograms/Demo_Graph_Noise.py diff --git a/Demo_Graph__Element.py b/DemoPrograms/Demo_Graph__Element.py similarity index 100% rename from Demo_Graph__Element.py rename to DemoPrograms/Demo_Graph__Element.py diff --git a/Demo_HowDoI.py b/DemoPrograms/Demo_HowDoI.py similarity index 100% rename from Demo_HowDoI.py rename to DemoPrograms/Demo_HowDoI.py diff --git a/Demo_Img_Viewer.py b/DemoPrograms/Demo_Img_Viewer.py similarity index 100% rename from Demo_Img_Viewer.py rename to DemoPrograms/Demo_Img_Viewer.py diff --git a/Demo_Keyboard.py b/DemoPrograms/Demo_Keyboard.py similarity index 100% rename from Demo_Keyboard.py rename to DemoPrograms/Demo_Keyboard.py diff --git a/Demo_Keyboard_Realtime.py b/DemoPrograms/Demo_Keyboard_Realtime.py similarity index 100% rename from Demo_Keyboard_Realtime.py rename to DemoPrograms/Demo_Keyboard_Realtime.py diff --git a/Demo_Keypad.py b/DemoPrograms/Demo_Keypad.py similarity index 100% rename from Demo_Keypad.py rename to DemoPrograms/Demo_Keypad.py diff --git a/Demo_LED_Clock_Weather.py b/DemoPrograms/Demo_LED_Clock_Weather.py similarity index 100% rename from Demo_LED_Clock_Weather.py rename to DemoPrograms/Demo_LED_Clock_Weather.py diff --git a/Demo_LED_Indicators.py b/DemoPrograms/Demo_LED_Indicators.py similarity index 97% rename from Demo_LED_Indicators.py rename to DemoPrograms/Demo_LED_Indicators.py index 57eb84b2..790b3cb8 100644 --- a/Demo_LED_Indicators.py +++ b/DemoPrograms/Demo_LED_Indicators.py @@ -1,51 +1,51 @@ -#!/usr/bin/env python -import sys - -if sys.version_info[0] >= 3: - import PySimpleGUI as sg -else: - import PySimpleGUI27 as sg -import time -import random - -""" - Demo program showing how to create your own "LED Indicators" - The LEDIndicator function acts like a new Element that is directly placed in a window's layout - After the Window is created, use the SetLED function to access the LED and set the color - -""" - - -def LEDIndicator(key=None, radius=30): - return sg.Graph(canvas_size=(radius, radius), - graph_bottom_left=(-radius, -radius), - graph_top_right=(radius, radius), - pad=(0, 0), key=key) - -def SetLED(window, key, color): - graph = window.FindElement(key) - graph.Erase() - graph.DrawCircle((0, 0), 12, fill_color=color, line_color=color) - - -layout = [[sg.Text('My LED Status Indicators', size=(20,1))], - [sg.Text('CPU Use'), LEDIndicator('_cpu_')], - [sg.Text('RAM'), LEDIndicator('_ram_')], - [sg.Text('Temperature'), LEDIndicator('_temp_')], - [sg.Text('Server 1'), LEDIndicator('_server1_')], - [sg.Button('Exit')]] - -window = sg.Window('My new window', default_element_size=(12, 1), auto_size_text=False).Layout(layout).Finalize() - -i = 0 -while True: # Event Loop - event, value = window.Read(timeout=400) - if event == 'Exit' or event is None: - break - if value is None: - break - i += 1 - SetLED(window, '_cpu_', 'green' if random.randint(1, 10) > 5 else 'red') - SetLED(window, '_ram_', 'green' if random.randint(1, 10) > 5 else 'red') - SetLED(window, '_temp_', 'green' if random.randint(1, 10) > 5 else 'red') - SetLED(window, '_server1_', 'green' if random.randint(1, 10) > 5 else 'red') +#!/usr/bin/env python +import sys + +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg +import time +import random + +""" + Demo program showing how to create your own "LED Indicators" + The LEDIndicator function acts like a new Element that is directly placed in a window's layout + After the Window is created, use the SetLED function to access the LED and set the color + +""" + + +def LEDIndicator(key=None, radius=30): + return sg.Graph(canvas_size=(radius, radius), + graph_bottom_left=(-radius, -radius), + graph_top_right=(radius, radius), + pad=(0, 0), key=key) + +def SetLED(window, key, color): + graph = window.FindElement(key) + graph.Erase() + graph.DrawCircle((0, 0), 12, fill_color=color, line_color=color) + + +layout = [[sg.Text('My LED Status Indicators', size=(20,1))], + [sg.Text('CPU Use'), LEDIndicator('_cpu_')], + [sg.Text('RAM'), LEDIndicator('_ram_')], + [sg.Text('Temperature'), LEDIndicator('_temp_')], + [sg.Text('Server 1'), LEDIndicator('_server1_')], + [sg.Button('Exit')]] + +window = sg.Window('My new window', default_element_size=(12, 1), auto_size_text=False).Layout(layout).Finalize() + +i = 0 +while True: # Event Loop + event, value = window.Read(timeout=400) + if event == 'Exit' or event is None: + break + if value is None: + break + i += 1 + SetLED(window, '_cpu_', 'green' if random.randint(1, 10) > 5 else 'red') + SetLED(window, '_ram_', 'green' if random.randint(1, 10) > 5 else 'red') + SetLED(window, '_temp_', 'green' if random.randint(1, 10) > 5 else 'red') + SetLED(window, '_server1_', 'green' if random.randint(1, 10) > 5 else 'red') diff --git a/Demo_MIDI_Player.py b/DemoPrograms/Demo_MIDI_Player.py similarity index 100% rename from Demo_MIDI_Player.py rename to DemoPrograms/Demo_MIDI_Player.py diff --git a/Demo_Machine_Learning.py b/DemoPrograms/Demo_Machine_Learning.py similarity index 100% rename from Demo_Machine_Learning.py rename to DemoPrograms/Demo_Machine_Learning.py diff --git a/Demo_Matplotlib.py b/DemoPrograms/Demo_Matplotlib.py similarity index 100% rename from Demo_Matplotlib.py rename to DemoPrograms/Demo_Matplotlib.py diff --git a/Demo_Matplotlib_Animated.py b/DemoPrograms/Demo_Matplotlib_Animated.py similarity index 100% rename from Demo_Matplotlib_Animated.py rename to DemoPrograms/Demo_Matplotlib_Animated.py diff --git a/Demo_Matplotlib_Animated_Scatter.py b/DemoPrograms/Demo_Matplotlib_Animated_Scatter.py similarity index 100% rename from Demo_Matplotlib_Animated_Scatter.py rename to DemoPrograms/Demo_Matplotlib_Animated_Scatter.py diff --git a/Demo_Matplotlib_Browser.py b/DemoPrograms/Demo_Matplotlib_Browser.py similarity index 100% rename from Demo_Matplotlib_Browser.py rename to DemoPrograms/Demo_Matplotlib_Browser.py diff --git a/Demo_Matplotlib_Ping_Graph.py b/DemoPrograms/Demo_Matplotlib_Ping_Graph.py similarity index 100% rename from Demo_Matplotlib_Ping_Graph.py rename to DemoPrograms/Demo_Matplotlib_Ping_Graph.py diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/DemoPrograms/Demo_Matplotlib_Ping_Graph_Large.py similarity index 100% rename from Demo_Matplotlib_Ping_Graph_Large.py rename to DemoPrograms/Demo_Matplotlib_Ping_Graph_Large.py diff --git a/Demo_Media_Player.py b/DemoPrograms/Demo_Media_Player.py similarity index 100% rename from Demo_Media_Player.py rename to DemoPrograms/Demo_Media_Player.py diff --git a/Demo_Menu_With_Toolbar.py b/DemoPrograms/Demo_Menu_With_Toolbar.py similarity index 100% rename from Demo_Menu_With_Toolbar.py rename to DemoPrograms/Demo_Menu_With_Toolbar.py diff --git a/Demo_Menus.py b/DemoPrograms/Demo_Menus.py similarity index 100% rename from Demo_Menus.py rename to DemoPrograms/Demo_Menus.py diff --git a/Demo_Multiple_Windows_Experimental.py b/DemoPrograms/Demo_Multiple_Windows_Experimental.py similarity index 100% rename from Demo_Multiple_Windows_Experimental.py rename to DemoPrograms/Demo_Multiple_Windows_Experimental.py diff --git a/Demo_Multithreaded_Logging.py b/DemoPrograms/Demo_Multithreaded_Logging.py similarity index 100% rename from Demo_Multithreaded_Logging.py rename to DemoPrograms/Demo_Multithreaded_Logging.py diff --git a/Demo_Nice_Buttons.py b/DemoPrograms/Demo_Nice_Buttons.py similarity index 100% rename from Demo_Nice_Buttons.py rename to DemoPrograms/Demo_Nice_Buttons.py diff --git a/Demo_NonBlocking_Form.py b/DemoPrograms/Demo_NonBlocking_Form.py similarity index 100% rename from Demo_NonBlocking_Form.py rename to DemoPrograms/Demo_NonBlocking_Form.py diff --git a/Demo_Notification_Window_Alpha_Channel.py b/DemoPrograms/Demo_Notification_Window_Alpha_Channel.py similarity index 100% rename from Demo_Notification_Window_Alpha_Channel.py rename to DemoPrograms/Demo_Notification_Window_Alpha_Channel.py diff --git a/Demo_OpenCV.py b/DemoPrograms/Demo_OpenCV.py similarity index 100% rename from Demo_OpenCV.py rename to DemoPrograms/Demo_OpenCV.py diff --git a/Demo_OpenCV_Simple_GUI.py b/DemoPrograms/Demo_OpenCV_Simple_GUI.py similarity index 100% rename from Demo_OpenCV_Simple_GUI.py rename to DemoPrograms/Demo_OpenCV_Simple_GUI.py diff --git a/Demo_OpenCV_Webcam.py b/DemoPrograms/Demo_OpenCV_Webcam.py similarity index 100% rename from Demo_OpenCV_Webcam.py rename to DemoPrograms/Demo_OpenCV_Webcam.py diff --git a/Demo_PDF_Viewer.py b/DemoPrograms/Demo_PDF_Viewer.py similarity index 100% rename from Demo_PDF_Viewer.py rename to DemoPrograms/Demo_PDF_Viewer.py diff --git a/Demo_PNG_Thumbnail_Viewer.py b/DemoPrograms/Demo_PNG_Thumbnail_Viewer.py similarity index 100% rename from Demo_PNG_Thumbnail_Viewer.py rename to DemoPrograms/Demo_PNG_Thumbnail_Viewer.py diff --git a/Demo_PNG_Viewer.py b/DemoPrograms/Demo_PNG_Viewer.py similarity index 100% rename from Demo_PNG_Viewer.py rename to DemoPrograms/Demo_PNG_Viewer.py diff --git a/Demo_PSG_SDK_Quick_Ref.py b/DemoPrograms/Demo_PSG_SDK_Quick_Ref.py similarity index 100% rename from Demo_PSG_SDK_Quick_Ref.py rename to DemoPrograms/Demo_PSG_SDK_Quick_Ref.py diff --git a/Demo_Password_Login.py b/DemoPrograms/Demo_Password_Login.py similarity index 100% rename from Demo_Password_Login.py rename to DemoPrograms/Demo_Password_Login.py diff --git a/Demo_Pi_LEDs.py b/DemoPrograms/Demo_Pi_LEDs.py similarity index 100% rename from Demo_Pi_LEDs.py rename to DemoPrograms/Demo_Pi_LEDs.py diff --git a/Demo_Pi_Robotics.py b/DemoPrograms/Demo_Pi_Robotics.py similarity index 100% rename from Demo_Pi_Robotics.py rename to DemoPrograms/Demo_Pi_Robotics.py diff --git a/Demo_Ping_Line_Graph.py b/DemoPrograms/Demo_Ping_Line_Graph.py similarity index 100% rename from Demo_Ping_Line_Graph.py rename to DemoPrograms/Demo_Ping_Line_Graph.py diff --git a/Demo_Pong.py b/DemoPrograms/Demo_Pong.py similarity index 100% rename from Demo_Pong.py rename to DemoPrograms/Demo_Pong.py diff --git a/Demo_Popup_Custom.py b/DemoPrograms/Demo_Popup_Custom.py similarity index 100% rename from Demo_Popup_Custom.py rename to DemoPrograms/Demo_Popup_Custom.py diff --git a/Demo_Popups.py b/DemoPrograms/Demo_Popups.py similarity index 100% rename from Demo_Popups.py rename to DemoPrograms/Demo_Popups.py diff --git a/Demo_Progress_Meters.py b/DemoPrograms/Demo_Progress_Meters.py similarity index 100% rename from Demo_Progress_Meters.py rename to DemoPrograms/Demo_Progress_Meters.py diff --git a/Demo_Pyplot_Bar_Chart.py b/DemoPrograms/Demo_Pyplot_Bar_Chart.py similarity index 100% rename from Demo_Pyplot_Bar_Chart.py rename to DemoPrograms/Demo_Pyplot_Bar_Chart.py diff --git a/Demo_Pyploy_Bar_Chart2.py b/DemoPrograms/Demo_Pyploy_Bar_Chart2.py similarity index 100% rename from Demo_Pyploy_Bar_Chart2.py rename to DemoPrograms/Demo_Pyploy_Bar_Chart2.py diff --git a/Demo_Script_Launcher.py b/DemoPrograms/Demo_Script_Launcher.py similarity index 100% rename from Demo_Script_Launcher.py rename to DemoPrograms/Demo_Script_Launcher.py diff --git a/Demo_Script_Parameters.py b/DemoPrograms/Demo_Script_Parameters.py similarity index 100% rename from Demo_Script_Parameters.py rename to DemoPrograms/Demo_Script_Parameters.py diff --git a/Demo_Spinner_Compound_Element.py b/DemoPrograms/Demo_Spinner_Compound_Element.py similarity index 100% rename from Demo_Spinner_Compound_Element.py rename to DemoPrograms/Demo_Spinner_Compound_Element.py diff --git a/Demo_Super_Simple_Form.py b/DemoPrograms/Demo_Super_Simple_Form.py similarity index 100% rename from Demo_Super_Simple_Form.py rename to DemoPrograms/Demo_Super_Simple_Form.py diff --git a/Demo_Table_CSV.py b/DemoPrograms/Demo_Table_CSV.py similarity index 100% rename from Demo_Table_CSV.py rename to DemoPrograms/Demo_Table_CSV.py diff --git a/Demo_Table_Element.py b/DemoPrograms/Demo_Table_Element.py similarity index 100% rename from Demo_Table_Element.py rename to DemoPrograms/Demo_Table_Element.py diff --git a/Demo_Table_Pandas.py b/DemoPrograms/Demo_Table_Pandas.py similarity index 100% rename from Demo_Table_Pandas.py rename to DemoPrograms/Demo_Table_Pandas.py diff --git a/Demo_Table_Simulation.py b/DemoPrograms/Demo_Table_Simulation.py similarity index 100% rename from Demo_Table_Simulation.py rename to DemoPrograms/Demo_Table_Simulation.py diff --git a/Demo_Tabs.py b/DemoPrograms/Demo_Tabs.py similarity index 100% rename from Demo_Tabs.py rename to DemoPrograms/Demo_Tabs.py diff --git a/Demo_Tabs_Nested.py b/DemoPrograms/Demo_Tabs_Nested.py similarity index 100% rename from Demo_Tabs_Nested.py rename to DemoPrograms/Demo_Tabs_Nested.py diff --git a/Demo_Tabs_Simple.py b/DemoPrograms/Demo_Tabs_Simple.py similarity index 100% rename from Demo_Tabs_Simple.py rename to DemoPrograms/Demo_Tabs_Simple.py diff --git a/Demo_Template.py b/DemoPrograms/Demo_Template.py similarity index 100% rename from Demo_Template.py rename to DemoPrograms/Demo_Template.py diff --git a/Demo_Timer.py b/DemoPrograms/Demo_Timer.py similarity index 100% rename from Demo_Timer.py rename to DemoPrograms/Demo_Timer.py diff --git a/Demo_Touch_Keyboard.py b/DemoPrograms/Demo_Touch_Keyboard.py similarity index 100% rename from Demo_Touch_Keyboard.py rename to DemoPrograms/Demo_Touch_Keyboard.py diff --git a/Demo_Tree_Element.py b/DemoPrograms/Demo_Tree_Element.py similarity index 100% rename from Demo_Tree_Element.py rename to DemoPrograms/Demo_Tree_Element.py diff --git a/Demo_Turtle.py b/DemoPrograms/Demo_Turtle.py similarity index 100% rename from Demo_Turtle.py rename to DemoPrograms/Demo_Turtle.py diff --git a/Demo_Window_Disappear.py b/DemoPrograms/Demo_Window_Disappear.py similarity index 100% rename from Demo_Window_Disappear.py rename to DemoPrograms/Demo_Window_Disappear.py diff --git a/Demo_YouTube_Intro.py b/DemoPrograms/Demo_YouTube_Intro.py similarity index 100% rename from Demo_YouTube_Intro.py rename to DemoPrograms/Demo_YouTube_Intro.py diff --git a/Demo_Youtube-dl_Frontend.py b/DemoPrograms/Demo_Youtube-dl_Frontend.py similarity index 100% rename from Demo_Youtube-dl_Frontend.py rename to DemoPrograms/Demo_Youtube-dl_Frontend.py diff --git a/Demo_psutil_Kill_Processes.py b/DemoPrograms/Demo_psutil_Kill_Processes.py similarity index 100% rename from Demo_psutil_Kill_Processes.py rename to DemoPrograms/Demo_psutil_Kill_Processes.py diff --git a/TutorialCPUUtilization.py b/DemoPrograms/TutorialCPUUtilization.py similarity index 100% rename from TutorialCPUUtilization.py rename to DemoPrograms/TutorialCPUUtilization.py diff --git a/DemoPrograms/default_icon.ico b/DemoPrograms/default_icon.ico new file mode 100644 index 00000000..1a41525e Binary files /dev/null and b/DemoPrograms/default_icon.ico differ diff --git a/ping.py b/DemoPrograms/ping.py similarity index 100% rename from ping.py rename to DemoPrograms/ping.py diff --git a/Mike_Cashes_Tkinter.py b/Mike_Cashes_Tkinter.py deleted file mode 100644 index 4dc7e357..00000000 --- a/Mike_Cashes_Tkinter.py +++ /dev/null @@ -1,93 +0,0 @@ -import PySimpleGUI as sg -import psutil -import time -from threading import Thread -import operator - -""" - Crashes with this information: - Tcl_AsyncDelete: async handler deleted by the wrong thread - - Process finished with exit code -2147483645 -""" - -# globale used to communicate with thread.. yea yea... it's working fine -g_interval = 1 -g_cpu_percent = 0 -g_procs = None -g_exit = False - -def CPU_thread(args): - global g_interval, g_cpu_percent, g_procs, g_exit - - while not g_exit: - try: - g_cpu_percent = psutil.cpu_percent(interval=g_interval) - g_procs = psutil.process_iter() - except: - pass - - -def main(): - global g_interval, g_procs, g_exit - - sg.PopupOKCancel('My popup') - - # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Black') - form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], - [sg.Text('', size=(30, 8), font=('Courier New', 12),text_color='white', justification='left', key='processes')], - [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')],] - - form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) - # start cpu measurement thread - thread = Thread(target=CPU_thread,args=(None,)) - thread.start() - # ---------------- main loop ---------------- - while (True): - # --------- Read and update window -------- - button, values = form.ReadNonBlocking() - - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - try: - g_interval = int(values['spin']) - except: - g_interval = 1 - - # cpu_percent = psutil.cpu_percent(interval=interval) # if don't wan to use a task - cpu_percent = g_cpu_percent - - # let the GUI run ever 700ms regardless of CPU polling time. makes window be more responsive - time.sleep(.7) - - display_string = '' - if g_procs: - # --------- Create list of top % CPU porocesses -------- - try: - top = {proc.name() : proc.cpu_percent() for proc in g_procs} - except: pass - - - top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) - if top_sorted: - top_sorted.pop(0) - display_string = '' - for proc, cpu in top_sorted: - display_string += '{:2.2f} {}\n'.format(cpu/10, proc) - - - # --------- Display timer in window -------- - form.FindElement('text').Update('CPU {}'.format(cpu_percent)) - form.FindElement('processes').Update(display_string) - - # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() - g_exit = True - thread.join() - exit(69) - -if __name__ == "__main__": - main() \ No newline at end of file