Major update of all demo programs to use new PEP8 bindings, etc

This commit is contained in:
PySimpleGUI 2019-10-23 16:10:03 -04:00
parent 3f7c87c562
commit 7f52778bcc
307 changed files with 19546 additions and 3297 deletions

View file

@ -1,6 +1,4 @@
#!/usr/bin/env python
import PySimpleGUI as sg
import PySimpleGUI as sg
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
@ -12,9 +10,6 @@ def draw_figure(canvas, figure):
figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1)
return figure_canvas_agg
def main():
# define the form layout
layout = [[sg.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')],
@ -24,7 +19,7 @@ def main():
# create the form and show it without the plot
window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI', layout, finalize=True)
canvas_elem = window.FindElement('-CANVAS-')
canvas_elem = window['-CANVAS-']
canvas = canvas_elem.TKCanvas
# draw the intitial scatter plot
fig, ax = plt.subplots()
@ -32,7 +27,7 @@ def main():
fig_agg = draw_figure(canvas, fig)
while True:
event, values = window.Read(timeout=10)
event, values = window.read(timeout=10)
if event in ('Exit', None):
exit(69)
@ -45,6 +40,7 @@ def main():
ax.scatter(x, y, c=color, s=scale, label=color, alpha=0.3, edgecolors='none')
ax.legend()
fig_agg.draw()
window.close()
if __name__ == '__main__':