Tkinter window changes dimensions or resolution when I use pyplot

淺唱寂寞╮ 提交于 2021-02-10 14:59:37

问题


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()

回答1:


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!



来源:https://stackoverflow.com/questions/43720019/tkinter-window-changes-dimensions-or-resolution-when-i-use-pyplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!