MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / main

Function main

DemoPrograms/Demo_Matplotlib_Ping_Graph_Large.py:113–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113def main():
114 global g_my_globals
115
116 # define the form layout
117 layout = [[sg.Text('Animated Ping', size=(40, 1),
118 justification='center', font='Helvetica 20')],
119 [sg.Image(size=(640, 480), key='-IMAGE-')],
120 [sg.Button('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]]
121
122 # create the form and show it without the plot
123 window = sg.Window(
124 'Demo Application - Embedding Matplotlib In PySimpleGUI', layout, finalize=True)
125
126 image_elem = window['-IMAGE-']
127
128 fig = plt.figure()
129 g_my_globals.axis_ping = fig.add_subplot(1, 1, 1)
130 set_chart_labels()
131 plt.tight_layout()
132 window.start_thread(lambda: ping_thread(window))
133 while True:
134 event, values = window.read(timeout=0)
135 if event in ('Exit', None):
136 break
137 if event == '-THREAD-':
138 graph_a_ping(values[event])
139 draw(image_elem, fig)
140
141
142

Calls 6

start_threadMethod · 0.95
readMethod · 0.95
set_chart_labelsFunction · 0.85
graph_a_pingFunction · 0.85
drawFunction · 0.85
ping_threadFunction · 0.70

Tested by

no test coverage detected