I have created a tkinter app which plots pyplot subplots on the screen (using matplotlib). When testing this on a Windows 10 laptop, I am finding that as soon as the plot is created, the tkinter root window shrinks dramatically.
I have boiled down the issue to the following code:
import tkinter as tk
import matplotlib.pyplot as plt
def plot():
fig, axs = plt.subplots(3, 6, sharey=True)
print('Button pushed')
return
root = tk.Tk()
b1 = tk.Button(root, text='Plot', command=(lambda: plot()))
b1.pack(side=tk.LEFT, padx=5, pady=5)
root.mainloop()
On my Windows 10 laptop, as soon as the "Plot" button is pushed, the tkinter root window dramatically shrinks. Interestingly, I do not see this same behavior on my Linux Mint laptop.
The desired behavior is for a plot to be shown on the screen (later, when plt.show()
is to be called), not embedded in the tkinter window, and not affecting the tkinter window at all.