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

Skip to content

Commit dc77096

Browse files
Phil Elsonpelson
Phil Elson
authored andcommitted
Fullscreen rather than maximize in Tk. Added fullscreen support to qt4 backend.
1 parent 507e9aa commit dc77096

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/matplotlib/backends/backend_qt4.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,12 @@ def _show_message(self,s):
383383
# Fixes a PySide segfault.
384384
self.window.statusBar().showMessage(s)
385385

386+
def full_screen_toggle(self):
387+
if self.window.isFullScreen():
388+
self.window.showNormal()
389+
else:
390+
self.window.showFullScreen()
391+
386392
def _widgetclosed( self ):
387393
if self.window._destroying: return
388394
self.window._destroying = True
@@ -394,7 +400,6 @@ def _widgetclosed( self ):
394400
# Gcf can get destroyed before the Gcf.destroy
395401
# line is run, leading to a useless AttributeError.
396402

397-
398403
def _get_toolbar(self, canvas, parent):
399404
# must be inited after the window, drawingArea and figure
400405
# attrs are set

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,8 @@ def set_window_title(self, title):
529529
self.window.wm_title(title)
530530

531531
def full_screen_toggle(self):
532-
# cross platform way of maximizing a tk window
533-
# http://devourer09.blogspot.co.uk/2009/07/maximizing-tkinter-app.html
534-
self.window.attributes('-zoomed', '1')
532+
is_fullscreen = bool(self.window.attributes('-fullscreen'))
533+
self.window.attributes('-fullscreen', not is_fullscreen)
535534

536535

537536
class AxisMenu:
@@ -919,4 +918,4 @@ def hidetip(self):
919918
tw = self.tipwindow
920919
self.tipwindow = None
921920
if tw:
922-
tw.destroy()
921+
tw.destroy()

0 commit comments

Comments
 (0)