Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c866d9f

Browse files
committed
added mpl icon to qt4 main window
svn path=/trunk/matplotlib/; revision=2532
1 parent a99fe3d commit c866d9f

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

images/matplotlib.png

3.33 KB
Loading

lib/matplotlib/backends/backend_qt4.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,19 @@ def __init__( self, canvas, num ):
151151
if DEBUG: print 'FigureManagerQT.%s' % fn_name()
152152
FigureManagerBase.__init__( self, canvas, num )
153153
self.canvas = canvas
154-
self.window = QtGui.QMainWindow()# None, None, QtCore.Qt.WDestructiveClose )
154+
self.window = QtGui.QMainWindow()
155155
self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
156156

157-
# TODO: add the mpl icon to the window
158-
#self.window.setWindowIcon(
159-
# QtGui.QIcon(os.path.join( matplotlib.rcParams['datapath'],
160-
# 'matplotlib.svg'))
161-
# )
157+
self.window.setWindowTitle("Figure %d" % num)
158+
image = os.path.join( matplotlib.rcParams['datapath'],'matplotlib.png' )
159+
self.window.setWindowIcon(QtGui.QIcon( image ))
162160

163161
centralWidget = QtGui.QWidget( self.window )
164162
self.canvas.setParent( centralWidget )
165163

166164
# Give the keyboard focus to the figure instead of the manager
167165
self.canvas.setFocusPolicy( QtCore.Qt.ClickFocus )
168166
self.canvas.setFocus()
169-
170-
self.window.setWindowTitle("Figure %d" % num)
171167

172168
QtCore.QObject.connect( self.window, QtCore.SIGNAL( 'destroyed()' ),
173169
self._widgetclosed )
@@ -185,6 +181,7 @@ def __init__( self, canvas, num ):
185181
# Use a vertical layout for the plot and the toolbar. Set the
186182
# stretch to all be in the plot so the toolbar doesn't resize.
187183
layout = QtGui.QVBoxLayout( centralWidget )
184+
layout.setMargin( 0 )
188185
layout.addWidget( self.canvas, 1 )
189186
if self.toolbar:
190187
layout.addWidget( self.toolbar, 0 )

0 commit comments

Comments
 (0)