diff --git a/DemoPrograms/Demo_Animated_GIFs.py b/DemoPrograms/Demo_Animated_GIFs.py index 2c3cf287..89d544b6 100644 --- a/DemoPrograms/Demo_Animated_GIFs.py +++ b/DemoPrograms/Demo_Animated_GIFs.py @@ -30,11 +30,11 @@ gifs = [ring_blue, red_dots_ring, ring_black_dots, ring_gray_segments, ring_line # first show how to use popup_animated using built-in GIF image for i in range(100000): - sg.popup_animated(sg.DEFAULT_BASE64_LOADING_GIF, no_titlebar=False, background_color='white', time_between_frames=100) + sg.popup_animated(sg.DEFAULT_BASE64_LOADING_GIF, message='Right Click To Exit GIF Windows That Follow\nLeft click to move to next one', no_titlebar=False, time_between_frames=100, text_color='black', background_color='white') sg.popup_animated(None) # close all Animated Popups # Next demo is to show how to create custom windows with animations -layout = [[sg.Image(data=gifs[0], enable_events=True, background_color='white', key='-IMAGE-', right_click_menu=['UNUSED', 'Exit'])],] +layout = [[sg.Image(data=gifs[0], enable_events=True, background_color='white', key='-IMAGE-', right_click_menu=['UNUSED', ['Exit']])],] window = sg.Window('My new window', layout, no_titlebar=True, @@ -53,7 +53,9 @@ while True: # Event Loop break elif event == '-IMAGE-': # if clicked on the image + if offset == len(gifs)-1: + break offset += (offset < len(gifs)-1) # add 1 until the last one gif = gifs[offset] # get a new gif image # update the animation in the window - window['-IMAGE-'].update_animation(gif, time_between_frames=100) + window['-IMAGE-'].update_animation(gif, time_between_frames=100) \ No newline at end of file diff --git a/DemoPrograms/Demo_Animated_GIFs_Using_PIL.py b/DemoPrograms/Demo_Animated_GIFs_Using_PIL.py index 5b56f7b0..4ffb8063 100644 --- a/DemoPrograms/Demo_Animated_GIFs_Using_PIL.py +++ b/DemoPrograms/Demo_Animated_GIFs_Using_PIL.py @@ -14,19 +14,20 @@ import PySimpleGUI as sg Copyright 2020 PySimpleGUI.org """ -gif_filename = r'my_gif_file.gif' +gif_filename = r'ExampleGIF.gif' -layout = [[sg.Image(key='-IMAGE-')]] +layout = [[sg.Text('Happy Thursday!', background_color='#A37A3B', text_color='#FFF000', justification='c', key='-T-', font=("Bodoni MT", 40))], + [sg.Image(key='-IMAGE-')]] window = sg.Window('Window Title', layout, element_justification='c', margins=(0,0), element_padding=(0,0), finalize=True) -sequence = [ImageTk.PhotoImage(img) for img in ImageSequence.Iterator(Image.open(gif_filename))] # must has finalized to do this +window['-T-'].expand(True, True, True) # Make the Text element expand to take up all available space interframe_duration = Image.open(gif_filename).info['duration'] # get how long to delay between frames while True: - for frame in sequence: + for frame in ImageSequence.Iterator(Image.open(gif_filename)): event, values = window.read(timeout=interframe_duration) if event == sg.WIN_CLOSED: - exit() - window['-IMAGE-'].update(data=frame) + exit(0) + window['-IMAGE-'].update(data=ImageTk.PhotoImage(frame) ) \ No newline at end of file diff --git a/DemoPrograms/Demo_Bar_Chart.py b/DemoPrograms/Demo_Bar_Chart.py index 5eea9f42..5bd71939 100644 --- a/DemoPrograms/Demo_Bar_Chart.py +++ b/DemoPrograms/Demo_Bar_Chart.py @@ -2,7 +2,7 @@ import PySimpleGUI as sg import random # Bars drawing in PySimpleGUI -# +# # .--. # | | # .--.| |.--. @@ -46,4 +46,4 @@ while True: graph.draw_rectangle(top_left=(i * BAR_SPACING + EDGE_OFFSET, graph_value), bottom_right=(i * BAR_SPACING + EDGE_OFFSET + BAR_WIDTH, 0), fill_color='blue') graph.draw_text(text=graph_value, location=(i*BAR_SPACING+EDGE_OFFSET+25, graph_value+10)) -window.close() +window.close() \ No newline at end of file diff --git a/DemoPrograms/Demo_Button_Toggle.py b/DemoPrograms/Demo_Button_Toggle.py index 896801eb..75c67dc6 100644 --- a/DemoPrograms/Demo_Button_Toggle.py +++ b/DemoPrograms/Demo_Button_Toggle.py @@ -6,6 +6,8 @@ import PySimpleGUI as sg Two versions are present... a simple button that changes text and a graphical one A HUGE thank you to the PySimpleGUI community memeber that donated his time and skill in creating the buttons! The text of the button toggles between Off and On + + Copyright 2021 PySimpleGUI """ def main(): @@ -34,4 +36,4 @@ def main(): if __name__ == '__main__': toggle_bt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Uo3YEdwycwFmN1yaD8ZOylqsra0NU0kJi36AwE+2jsfjOtk6yGJs3d+KRS8vRPOBt3LJ1hGWE2efx2RrnVztRS5kxvOzdE1LL9ud+tzCkJK3SJneoyfTtnFYE26+cAHGVI/RRkCQbJ1IJM6rra0tSLYeFJDgOEIsFguPI9A2L7Wv+XgN/vOdn6B591tAnB0fxxECYBy/ZqUHhJsLo8Pf3yBHGRmgYUQT/qFxPhrHN2ogkFMLJKYuHTt27Kd9f4awGPDAjm8XE4pNUsr7HccJD+xMPXkqpo2dhgM9B7Dy/TfwbutabOvchvYD7eh1e+HS3uTn+cCO9I+vSe+ew0CxiKM6Xo3ailpMrpmiwyHDKqpDp88/SUXW1JLe3t7rx48fP/iBnYE4JL8QupZl0ZG2H8Tj8emUs/qnI21HVvKOtLUkk8nrxo0b9/ahHhyUQ/ILOYqZTKbZcZyGTCYzK5lMfjMajZ4fiUT0oU8vIir+dOgz79CnHz3P2rb9q0wm88NTTjll+ZHOc1gOKRjsn8Y1TZOORVOC3dmWZdUbhqGPRXPOS49TQHqUUj1SSjoWvdlxnJXZbPa1bDbbQb4K1SM6Fg3g/wC58vyvEBd3YwAAAABJRU5ErkJggg==' - main() + main() \ No newline at end of file diff --git a/DemoPrograms/Demo_Button_Toggle2.py b/DemoPrograms/Demo_Button_Toggle2.py index 47c16c9a..5c27bdab 100644 --- a/DemoPrograms/Demo_Button_Toggle2.py +++ b/DemoPrograms/Demo_Button_Toggle2.py @@ -38,6 +38,7 @@ class BtnInfo: # Main function that creates the layout, window and has event loop def main(): layout = [[sg.Text('Toggle Button')], + [sg.T('Disabled with PySimpleGUI Ignore:', text_color='yellow')], [sg.Button(image_data=on_image, k='-TOGGLE1-', border_width=0, button_color=(sg.theme_background_color(), sg.theme_background_color()), disabled_button_color=(sg.theme_background_color(), sg.theme_background_color()), @@ -46,12 +47,23 @@ def main(): sg.Button(image_data=off_image, k='-DISABLE1-', border_width=0, button_color=(sg.theme_background_color(), sg.theme_background_color()), disabled_button_color=(sg.theme_background_color(), sg.theme_background_color()), - metadata=BtnInfo(False)), + metadata=BtnInfo(False)), sg.T('Disabled button color is\nbetter than other disabled button below') ], [sg.Button(image_data=on_image, k='-TOGGLE2-', border_width=0, button_color=(sg.theme_background_color(), sg.theme_background_color()), disabled_button_color=(sg.theme_background_color(), sg.theme_background_color()), metadata=BtnInfo())], + [ sg.T('Disabled with GUI:', text_color='yellow')], + [sg.Button(image_data=on_image, k='-TOGGLE3-', border_width=0, + button_color=(sg.theme_background_color(), sg.theme_background_color()), + disabled_button_color=(sg.theme_background_color(), sg.theme_background_color()), + disabled=True, metadata=BtnInfo()), sg.T('Note color has crosshatching')], + [ sg.T('Disabled with PySimpleGUI (ignored):', text_color='yellow')], + [sg.Button(image_data=on_image, k='-TOGGLE3-', border_width=0, + button_color=(sg.theme_background_color(), sg.theme_background_color()), + disabled_button_color=(sg.theme_background_color(), sg.theme_background_color()), + disabled=sg.BUTTON_DISABLED_MEANS_IGNORE, metadata=BtnInfo())], + [sg.T(size=(40,1), k='-STATUS-')], [sg.Button('Exit')]] window = sg.Window('Window Title', layout, font='_ 14', finalize=True) @@ -80,7 +92,7 @@ def main(): window['-TOGGLE1-'].update(disabled=False, image_data=on_image) elif window['-TOGGLE1-'].metadata.state is False: window['-TOGGLE1-'].update(disabled=False, image_data=off_image) - + window['-STATUS-'].update(f'event {event} button state = {window[event].metadata.state}') window.close() # Define the button graphic base 64 strings and then call the main function diff --git a/DemoPrograms/Demo_Change_Submits_InputText.py b/DemoPrograms/Demo_Change_Submits_InputText.py deleted file mode 100644 index d54c2cfc..00000000 --- a/DemoPrograms/Demo_Change_Submits_InputText.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -import PySimpleGUI as sg -""" - Demonstrates the new change_submits parameter for inputtext elements - It ONLY submits when a button changes the field, not normal user input - Be careful on persistent forms to not clear the input -""" -layout = [[sg.Text('Test of reading input field')], - [sg.Text('This input is normal'), sg.Input()], - [sg.Text('This input change submits'), - sg.Input(change_submits=True)], - [sg.Text('This multiline input change submits'), - sg.ML('', change_submits=True)], - [sg.Text('This input is normal'), - sg.Input(), sg.FileBrowse()], - [sg.Text('File Browse submits'), - sg.Input(change_submits=True, - key='-in1-'), sg.FileBrowse()], - [sg.Text('Color Chooser submits'), - sg.Input(change_submits=True, - key='-in2-'), sg.ColorChooserButton('Color...', target=(sg.ThisRow, -1))], - [sg.Text('Folder Browse submits'), - sg.Input(change_submits=True, - key='-in3-'), sg.FolderBrowse()], - [sg.Text('Calendar Chooser submits'), - sg.Input(change_submits=True, - key='-in4-'), sg.CalendarButton('Date...', target=(sg.ThisRow, -1))], - [sg.Text('Disabled input submits'), - sg.Input(change_submits=True, - disabled=True, - key='_in5'), sg.FileBrowse()], - [sg.Text('This input clears after submit'), - sg.Input(change_submits=True, key='-in6-'), sg.FileBrowse()], - [sg.Button('Read')]] - -window = sg.Window('Demonstration of InputText with change_submits', - layout, auto_size_text=False, default_element_size=(22, 1), - text_justification='right') - -while True: # Event Loop - event, values = window.read() - print(event, values) - if event == sg.WIN_CLOSED: - break - -window.close() diff --git a/DemoPrograms/Demo_Chat.py b/DemoPrograms/Demo_Chat.py index 398553eb..76b9a635 100644 --- a/DemoPrograms/Demo_Chat.py +++ b/DemoPrograms/Demo_Chat.py @@ -10,11 +10,11 @@ sg.theme('GreenTan') # give our window a spiffy set of colors layout = [[sg.Text('Your output will go here', size=(40, 1))], [sg.Output(size=(110, 20), font=('Helvetica 10'))], - [sg.Multiline(size=(70, 5), enter_submits=True, key='-QUERY-', do_not_clear=False), + [sg.Multiline(size=(70, 5), enter_submits=False, key='-QUERY-', do_not_clear=False), sg.Button('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] -window = sg.Window('Chat window', layout, font=('Helvetica', ' 13'), default_button_element_size=(8,2)) +window = sg.Window('Chat window', layout, font=('Helvetica', ' 13'), default_button_element_size=(8,2), use_default_focus=False) while True: # The Event Loop event, value = window.read() @@ -23,6 +23,6 @@ while True: # The Event Loop if event == 'SEND': query = value['-QUERY-'].rstrip() # EXECUTE YOUR COMMAND HERE - print('The command you entered was {}'.format(query)) + print('The command you entered was {}'.format(query), flush=True) -window.close() +window.close() \ No newline at end of file diff --git a/DemoPrograms/exampleGIF.gif b/DemoPrograms/exampleGIF.gif new file mode 100644 index 00000000..212b4a24 Binary files /dev/null and b/DemoPrograms/exampleGIF.gif differ