1

When we run a python script(test.py):

import matplotlib.pyplot as plt
import pylab 
import win32com.client as win32 
import os

mng =  pylab.get_current_fig_manager()
mng.window.showMaximized()

It will show the following error message:

Traceback (most recent call last):
  File "C:\test.py", line 6, in <module>
    mng.window.showMaximized()
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1826, in __getattr__
    return getattr(self.tk, attr)
AttributeError: showMaximized

Our operation system is Windows 7. We have installed "matplotlib‑1.3.1.win32‑py2.7.exe", and the corresponding numpy, dateutil, pytz, pyparsing, six and win32com.client.

We couldn't find any solution after the search. Could any guru kindly offer some comments/solutions? Thanks.

Chubaka
  • 2,933
  • 7
  • 43
  • 58

1 Answers1

1

The object returned by get_current_fig_manager depends on the backend used to render the image. Based on your error, it seems you are using Tk backend, so the window object will be a Tk window, so the methods available will be those of a Tk window. This does not have a showMaximized. Most likely you have to use mng.window.state('zoomed'). See this particular answer for more details.

Community
  • 1
  • 1
Oliver
  • 27,510
  • 9
  • 72
  • 103