当我使用 pyplot 时,Tkinter 窗口会更改尺寸或分辨率 [英] Tkinter window changes dimensions or resolution when I use pyplot

查看:50
本文介绍了当我使用 pyplot 时,Tkinter 窗口会更改尺寸或分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首次发布,但是发现这些论坛对我的python学习非常有帮助!

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

我在调用 plt.plot 时遇到问题,因为它正在调整我的 tkinter 窗口的大小.我在python 2.7和3.5中都尝试过这个问题.

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.

之前

之后

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

推荐答案

在窗口自定义显示下有一个滚动条用于:更改文本、应用和其他项目的大小:150%(推荐)"

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

当我将其更改为100%时,tkinter窗口不再调整大小.

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

谢谢@ R.p.T试图帮助我!

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

这篇关于当我使用 pyplot 时,Tkinter 窗口会更改尺寸或分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆