<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Anthony<div class="">hi everyone</div><div class="">i feel blocked at the just beginning of my attempts with PySimpleGUI/MatPlotLib</div><div class="">with exactly your code i get this answer :</div><div class="">i dont know in which direction to search :</div><div class="">Vincent</div><div class="">-------</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2020-12-03 16:20:55.678 Python[17698:7853902] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ff7e7890560</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">2020-12-03 16:20:55.686 Python[17698:7853902] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7ff7e7890560'</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">*** First throw call stack:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>0   CoreFoundation                      0x00007fff2eafda7d __exceptionPreprocess + 256</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>1   libobjc.A.dylib                     0x00007fff591cea17 objc_exception_throw + 48</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>2   CoreFoundation                      0x00007fff2eb77886 -[NSObject(NSObject) __retain_OA] + 0</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>3   CoreFoundation                      0x00007fff2ea9f8ef ___forwarding___ + 1485</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>4   CoreFoundation                      0x00007fff2ea9f298 _CF_forwarding_prep_0 + 120</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>5   libtk8.6.dylib                      0x0000000102bf41f2 TkpInit + 408</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>6   libtk8.6.dylib                      0x0000000102b63aac Initialize + 2454</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>7   _tkinter.cpython-39-darwin.so       0x00000001029b7704 Tcl_AppInit + 84</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>8   _tkinter.cpython-39-darwin.so       0x00000001029b7022 _tkinter_create + 1362</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>9   Python                              0x00000001020d672a cfunction_vectorcall_FASTCALL + 218</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>10  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>11  Python                              0x000000010216bd93 _PyEval_EvalFrameDefault + 25219</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>12  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>13  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>14  Python                              0x00000001020980b5 _PyObject_FastCallDictTstate + 293</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>15  Python                              0x0000000102098c98 _PyObject_Call_Prepend + 152</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>16  Python                              0x00000001020f21e5 slot_tp_init + 165</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>17  Python                              0x00000001020ed699 type_call + 345</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>18  Python                              0x000000010209825d _PyObject_MakeTpCall + 365</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>19  Python                              0x000000010216e8fc call_function + 876</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>20  Python                              0x000000010216be2b _PyEval_EvalFrameDefault + 25371</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>21  Python                              0x0000000102098a28 function_code_fastcall + 104</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>22  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>23  Python                              0x000000010216bd93 _PyEval_EvalFrameDefault + 25219</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>24  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>25  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>26  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>27  Python                              0x000000010216bd93 _PyEval_EvalFrameDefault + 25219</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>28  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>29  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>30  Python                              0x00000001020980b5 _PyObject_FastCallDictTstate + 293</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>31  Python                              0x0000000102098c98 _PyObject_Call_Prepend + 152</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>32  Python                              0x00000001020f21e5 slot_tp_init + 165</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>33  Python                              0x00000001020ed699 type_call + 345</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>34  Python                              0x000000010209825d _PyObject_MakeTpCall + 365</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>35  Python                              0x000000010216e8fc call_function + 876</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>36  Python                              0x000000010216bd93 _PyEval_EvalFrameDefault + 25219</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>37  Python                              0x0000000102098a28 function_code_fastcall + 104</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>38  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>39  Python                              0x000000010216be2b _PyEval_EvalFrameDefault + 25371</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>40  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>41  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>42  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>43  Python                              0x000000010216bd72 _PyEval_EvalFrameDefault + 25186</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>44  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>45  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>46  Python                              0x000000010209aa6a method_vectorcall + 202</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>47  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>48  Python                              0x000000010216bec1 _PyEval_EvalFrameDefault + 25521</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>49  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>50  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>51  Python                              0x000000010209aa6a method_vectorcall + 202</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>52  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>53  Python                              0x000000010216bec1 _PyEval_EvalFrameDefault + 25521</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>54  Python                              0x0000000102098a28 function_code_fastcall + 104</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>55  Python                              0x000000010216e86c call_function + 732</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>56  Python                              0x000000010216bd72 _PyEval_EvalFrameDefault + 25186</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>57  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>58  Python                              0x00000001020989b1 _PyFunction_Vectorcall + 289</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>59  Python                              0x000000010209802f _PyObject_FastCallDictTstate + 159</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>60  Python                              0x0000000102098c98 _PyObject_Call_Prepend + 152</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>61  Python                              0x00000001020f21e5 slot_tp_init + 165</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>62  Python                              0x00000001020ed699 type_call + 345</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>63  Python                              0x000000010209825d _PyObject_MakeTpCall + 365</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>64  Python                              0x000000010216e8fc call_function + 876</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>65  Python                              0x000000010216bec1 _PyEval_EvalFrameDefault + 25521</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>66  Python                              0x000000010216f563 _PyEval_EvalCode + 2611</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>67  Python                              0x00000001021659eb PyEval_EvalCode + 139</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>68  Python                              0x00000001021b8352 PyRun_FileExFlags + 434</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>69  Python                              0x00000001021b792f PyRun_SimpleFileExFlags + 831</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>70  Python                              0x00000001021d47e9 Py_RunMain + 1801</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>71  Python                              0x00000001021d4c7f pymain_main + 223</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>72  Python                              0x00000001021d4e7b Py_BytesMain + 43</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>73  libdyld.dylib                       0x00007fff5a99c3d5 start + 1</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">libc++abi.dylib: terminating with uncaught exception of type NSException</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Abort trap: 6</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div><br class=""><blockquote type="cite" class=""><div class="">Le 30 nov. 2020 à 15:31, Anthony Billings <<a href="mailto:ABillings@axustech.com" class="">ABillings@axustech.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: IowanOldStyle-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">When I want to embed an MPL plot inside of a tkinter window I use PySimpleGUI. It’s a quick and easy module that makes working with tkinter much more manageable. I’ve found an example that uses PySimpleGui and embeds a simple MPL plot inside. I hope this helps. Happy coding!<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class="">#!/usr/bin/env python</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> PySimpleGUI </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">as</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> sg<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> matplotlib<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">from</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> matplotlib.backends.backend_tkagg </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> FigureCanvasTkAgg<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># matplotlib.use('TkAgg')</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> numpy </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">as</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> np<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> matplotlib.pyplot </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">as</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> plt<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">"""</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">Demonstrates one way of embedding Matplotlib figures into a PySimpleGUI window.</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">Paste your Pyplot code into the section marked below.</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">Do all of your plotting as you normally would, but do NOT call plt.show(). </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">Stop just short of calling plt.show() and let the GUI do the rest.</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">The remainder of the program will convert your plot and display it in the GUI.</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">If you want to change the GUI, make changes to the GUI portion marked below.</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">"""</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> matplotlib.pyplot </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">as</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> plt <o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">import</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> numpy </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">as</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> np    <o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(86, 156, 214);" class="">def</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(220, 220, 170);" class="">abline</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">slope</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">intercept</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">):<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">"""Plot a line from slope and intercept"""</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    axes = plt.gca()<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    x_vals = np.array(axes.get_xlim())<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    y_vals = intercept + slope * x_vals<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    plt.plot(x_vals, y_vals, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'--'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># ------------------------------- PASTE YOUR MATPLOTLIB CODE HERE -------------------------------</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">abline(-</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0.3</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">1</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">plt.ylim(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0.5</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">1.5</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">plt.xlim(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">,</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">1</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30); background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># ------------------------------- END OF YOUR MATPLOTLIB CODE -------------------------------</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># ------------------------------- Beginning of Matplotlib helper code -----------------------</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(86, 156, 214);" class="">def</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(220, 220, 170);" class="">draw_figure</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">canvas</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">figure</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">loc</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)):<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    figure_canvas_agg = FigureCanvasTkAgg(figure, canvas)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    figure_canvas_agg.draw()<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    figure_canvas_agg.get_tk_widget().pack(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">side</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'top'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">fill</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'both'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">expand</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">1</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(197, 134, 192);" class="">return</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""> figure_canvas_agg<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># ------------------------------- Beginning of GUI CODE -------------------------------</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30); background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">fig = plt.gcf()  </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># if using Pyplot then get the figure from the plot</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># define the window layout</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">layout = [[sg.Text(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'Plot test'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">font</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'Any 18'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)],<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">          [sg.Canvas(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">size</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=(figure_w, figure_h), </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">key</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'-CANVAS-'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)],<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">          [sg.OK(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">pad</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=((figure_w / </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">2</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">0</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">), </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">3</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">), </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">size</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">4</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(181, 206, 168);" class="">2</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">))]]<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># create the form and show it without the plot</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">window = sg.Window(</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'Demo Application - Embedding Matplotlib In PySimpleGUI'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">    layout, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">force_toplevel</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(86, 156, 214);" class="">True</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">, </span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(156, 220, 254);" class="">finalize</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">=</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(86, 156, 214);" class="">True</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># add the plot to the window</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">fig_photo = draw_figure(window[</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(206, 145, 120);" class="">'-CANVAS-'</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">].TKCanvas, fig)<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(106, 153, 85);" class=""># show it all again and get buttons</span><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">event, values = window.read()<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.25pt; background-color: rgb(30, 30, 30);" class=""><span style="font-size: 10.5pt; font-family: Consolas; color: rgb(212, 212, 212);" class="">window.close()<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div class=""><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(225, 225, 225); padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Matplotlib-users <<a href="mailto:matplotlib-users-bounces+abillings=axustech.com@python.org" class="">matplotlib-users-bounces+abillings=axustech.com@python.org</a>><span class="Apple-converted-space"> </span><b class="">On Behalf Of<span class="Apple-converted-space"> </span></b>Vincent Douce Mathoscope<br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Monday, November 30, 2020 5:53 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span><a href="mailto:matplotlib-users@python.org" class="">matplotlib-users@python.org</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[Matplotlib-users] tk and matplotlib<o:p class=""></o:p></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">hi</span><o:p class=""></o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">i am creating a matplotlib draw (musical sales on a guitar) in function of some parameters (tonic note, type of gamme or chord...)<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">i am now creating tk radio buttons so that the user can choose the parameters<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">i can get these parameters and create the matplotlib picture with them<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">but the matplotlib will open a different window<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-family: IowanOldStyle-Roman, serif;" class="">would it be possible to have a same window, divided as a table, with at the lift the radio buttons, and at the right the matplotlib result ?<o:p class=""></o:p></span></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="" class="">----<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="" class=""><a href="https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flemathoscope.com%2f&c=E,1,6vcd1-3cyy9rlYSvGPYjXZjP8pMdDLA0ZtZConnBK6PmFwpI6mZPG-h5-3MDOJ5IiIUqm7msJCw9kYECyLC9LoZVreR0FdEmkAWQ24yv8JApkqfCnPs,&typo=1" style="color: blue; text-decoration: underline;" class="">https://lemathoscope.com/</a><o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="" class="">cours de maths postbac par visio</span></div></div></div></div></div></div></blockquote></div><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>----</div><div><a href="https://lemathoscope.com/" class="">https://lemathoscope.com/</a></div><div>cours de maths postbac par visio</div></div>

</div>
<br class=""></div></body></html>