user3053231
user3053231

Reputation:

Disable window maximization in matplotlib figure window

Is there any possible way to disable the figure maximization button in the matplotlib figure window? I'm on Ubuntu 13.10.

Upvotes: 1

Views: 334

Answers (1)

Alvaro Fuentes
Alvaro Fuentes

Reputation: 17455

Well, if you are using PyQt as back-end you can do this:

import matplotlib.pyplot as plt
from PyQt4.QtCore import Qt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(10),range(10))

#get the parent window of the canvas and set the flags
fig.canvas.parent().setWindowFlags(
    Qt.WindowSystemMenuHint|
    Qt.WindowMinimizeButtonHint|
    Qt.WindowCloseButtonHint)

plt.show()

With this approach you can adapt the solution to your actual back-end: just get the canvas, then the window parent (back-end dependent) and configure the window (if it is possible?)

Upvotes: 1

Related Questions