-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Error using "set_window_title" for canvas via backend_qt5agg #17716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you provide a more complete example that reproduces the problem? |
Also, thank you for testing the RC 😄 |
Here is a code example that shows issue. # -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtGui, QtWidgets
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from PyQt5 import QtCore
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(745, 556)
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
QtCore.QMetaObject.connectSlotsByName(Form)
#
self.setup_plot()
def setup_plot(self):
dpi = 75
fig1 = plt.figure(dpi=dpi, facecolor='#617f8a', tight_layout=True)
mpl.rc('axes', facecolor='#ffffff')
self.plot1 = fig1.add_subplot(111)
self.canvas1 = FigureCanvas(fig1)
self.verticalLayout.addWidget(self.canvas1)
toolbar = NavigationToolbar(self.canvas1, self.canvas1)
toolbar.setMaximumSize(QtCore.QSize(16777215, 35))
self.verticalLayout.addWidget(toolbar)
self.canvas1.set_window_title('Title Test')
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_()) [@tacaswell edited to add multi-line markup] |
Thanks @NHades ! |
Thanks for fast response! |
Hi, is this issue fixed? currently I'm still facing same issue with matplotlib==3.7.3 |
Please open a new issue with a specific reproducer if you are still seeing this problem. |
I found the solution. Thanks for your reply and have a good day |
Bug summary
When using "set_window_title" I get this error:
self.manager.set_window_title(title)
AttributeError: 'NoneType' object has no attribute 'set_window_title'
Located in this file and error:
File "..\lib\site-packages\matplotlib\backend_bases.py", line 2245, in set_window_title
self.manager.set_window_title(title)
AttributeError: 'NoneType' object has no attribute 'set_window_title'
Code for reproduction
self.canvas.set_window_title('Some Text')
print(matplotlib.get_backend())
): matplotlib.backends.backend_qt5aggThe text was updated successfully, but these errors were encountered: