When I do plt.figure in PySimpleGUI, the window shrinks.

Asked 2 years ago, Updated 2 years ago, 70 views

If I create a figure object with matplotlib.pyplot while using PySimpleGUI, the window size of the application created with PySimpleGUI will be fixedly reduced. Is there any way to avoid this?

Run Environment
Python 3.10.2
matplotlib 3.5.1
PySimpleGUI 4.57.0
Windows 11 Home(21H2)
Intel® Core™ i5-1035G4 [email protected] 1.50GHz

source code

import PySimpleGUI aspg
import matplotlib.pyplot asplt

layout = [
    [pg.Button(key='-button-', button_text='')]
]

window=pg.Window('demo', layout, size=(800,600))


while True:
    event,_=window.read()

    if event==None:
        break
    if event=='-button-':
        plt.figure()

python python3 matplotlib

2022-09-30 11:26

1 Answers

I have a similar question on another site, so I will share it here.

https://github.com/PySimpleGUI/PySimpleGUI/issues/4561


2022-09-30 11:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.