Search code examples
python-2.7python-3.xplottkinterplt

Tkinter window changes dimensions or resolution when I use pyplot


First time posting, but have found these forums incredibly helpful with my python learning!

I have a problem when I call plt.plot as it's resizing my tkinter window. I've tried this in python 2.7 and 3.5 both seem to have the issue.

Below is just some sample code to re-create the problem. You don't even need to show the graph for this problem to be re-created as soon as you plot the data it resizes.

Before

After

from tkinter import *
import matplotlib.pyplot as plt

x = [1,2,3,4,5]
master = Tk() 
def plotting():
    plt.plot(x)
    #plt.show()



master.minsize(width=450, height=600)
master.wm_title("Tester")

#
y = Button(master, text='START', command=plotting )
y.place(x=230, y=180)

master.mainloop()

Solution

  • Under windows customize display there's a scrollbar for: "Change the size of text, apps and other items: 150% (Recommended)"

    When I changed that to 100% the tkinter window no longer resizes.

    Thank you @R.p.T for trying to assist me!