Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取调整大小的matplotlib打印窗口的大小_Python_Resize_Plot_Matplotlib_Tkinter - Fatal编程技术网

Python 获取调整大小的matplotlib打印窗口的大小

Python 获取调整大小的matplotlib打印窗口的大小,python,resize,plot,matplotlib,tkinter,Python,Resize,Plot,Matplotlib,Tkinter,我正在使用matplotlib和Tkinter绘制一些数据。当我按下一个按钮时,我的图形是在一个给定大小的独立窗口中创建的。如果我再次单击按钮,图形将再次在相同位置创建。现在,如果我第一次按下按钮后手动调整窗口大小,下次按下按钮时,窗口将恢复到我设置的原始大小。有没有办法“读取”我用鼠标光标手动修改的窗口大小,以便下次按下按钮时,图形显示在同一窗口中 以下是我的代码: plt.Figure() thismanager = get_current_fig_manager() thismanager

我正在使用matplotlib和Tkinter绘制一些数据。当我按下一个按钮时,我的图形是在一个给定大小的独立窗口中创建的。如果我再次单击按钮,图形将再次在相同位置创建。现在,如果我第一次按下按钮后手动调整窗口大小,下次按下按钮时,窗口将恢复到我设置的原始大小。有没有办法“读取”我用鼠标光标手动修改的窗口大小,以便下次按下按钮时,图形显示在同一窗口中

以下是我的代码:

plt.Figure()
thismanager = get_current_fig_manager()
thismanager.window.wm_geometry("500x500+890+300")
thismanager.set_window_title('Title')

plt.clf()
plt.xlabel('Xaxis',fontsize=16)

im=imshow(variableName,cmap='gray',origin='lower',vmin=0,vmax=255,interpolation='nearest')

cb=colorbar()
cb.set_label('Label',fontsize=16)
show()

我找到了一个解决方案,代码如下:

plt.Figure()
thismanager = get_current_fig_manager()
thismanager.window.wm_geometry("500x500+890+300") #sets original size and position
button = Tkinter.Button(self,command=self.Click)

def Click(self):
   thismanager = get_current_fig_manager()
   thismanager.set_window_title('Title')
   plt.clf()
   plt.xlabel('Xaxis',fontsize=16)
   im=imshow(variable, cmap='gray', origin='lower',vmin=0,vmax=255,interpolation='nearest')
   cb=colorbar()
   cb.set_label('Label',fontsize=16)
   show()

我找到了一个解决方案,代码如下:

plt.Figure()
thismanager = get_current_fig_manager()
thismanager.window.wm_geometry("500x500+890+300") #sets original size and position
button = Tkinter.Button(self,command=self.Click)

def Click(self):
   thismanager = get_current_fig_manager()
   thismanager.set_window_title('Title')
   plt.clf()
   plt.xlabel('Xaxis',fontsize=16)
   im=imshow(variable, cmap='gray', origin='lower',vmin=0,vmax=255,interpolation='nearest')
   cb=colorbar()
   cb.set_label('Label',fontsize=16)
   show()