Skip to content
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

Tabbed gtk3 figuremanager #2465

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
01b0e78
refactoring FigureManagerBase to include include self in all calls to…
fariza Sep 12, 2013
ec262ad
Modified to use container for figure managers and for toolbars
fariza Sep 13, 2013
4e1d8c4
Adding standaone savefiguredialog
fariza Sep 15, 2013
a7e9968
Subplot tool and save as external clasess, working on weakref to keep…
fariza Sep 15, 2013
6c13b83
Added external buttons, trying to figure out how to keep track of them
fariza Sep 16, 2013
61d8427
Cleanup, commit to show what can be done
fariza Sep 17, 2013
b9204e5
Forgot to include external button
fariza Sep 17, 2013
0f6023e
Placing stuff in backend_bases.py and renaming rc param to single_window
fariza Sep 18, 2013
b48e903
renaming rcparam in demo
fariza Sep 18, 2013
a7ab976
adding remove_tool and move_tool
fariza Sep 18, 2013
a582aeb
Adding passthought **kwargs to add_tool, default value for buttons no…
fariza Sep 19, 2013
375f32e
adding tool for lineproperties
fariza Sep 20, 2013
5ec539f
adding saveall images from http://openiconlibrary.sourceforge.net/gal…
fariza Sep 24, 2013
ecd3c91
Adding image to saveall tool, changing order to have saveall side to …
fariza Sep 25, 2013
0f3abfe
Fixing new buttons not showing after toolbar init
fariza Sep 26, 2013
a6bc104
Saveall image uses same original filesave, the colors and motive match
fariza Sep 26, 2013
2c06a64
rebase for review
fariza Oct 23, 2013
cf80c97
pep8 correction
fariza Oct 23, 2013
7033c46
removing backedn_gtk3cairo.py from test_coding_standards
fariza Oct 23, 2013
84a1911
splitting toolbar and figuremanager examples
fariza Oct 28, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions examples/user_interfaces/multifigure_backend_gtk3.py
@@ -0,0 +1,56 @@
import matplotlib
matplotlib.use('GTK3Agg')
matplotlib.rcParams['backend.single_window'] = True
import matplotlib.pyplot as plt


import numpy as np

x = np.arange(100)

#Create 4 figures
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
ax1.plot(x, x)

fig2 = plt.figure()
ax2 = fig2.add_subplot(111)
ax2.plot(x, np.sqrt(x))


fig3 = plt.figure()
ax3 = fig3.add_subplot(111)
ax3.plot(x, x ** 2)

fig4 = plt.figure()
ax4 = fig4.add_subplot(111)
ax4.plot(x, x ** 3)


###################
#Figure management
#Change the figure1 tab label
fig1.canvas.manager.set_window_title('Just a line')

#Change the figure manager window title
fig1.canvas.manager.set_mainwindow_title('The powerful window manager')

#Detach figure3 from the rest
fig3.canvas.manager.detach()

#Put the figure4 in the same manager as fig3
fig4.canvas.manager.reparent(fig3)

#Control the parent from the figure instantiation with the parent argument
#To place it in the same parent as fig1 we have several options
#parent=fig1
#parent=fig1.canvas.manager
#parent=fig2.canvas.manager.parent
fig5 = plt.figure(parent=fig1)
ax5 = fig5.add_subplot(111)
ax5.plot(x, x**4)
#if we want it in a separate window
#parent=False


plt.show()
38 changes: 38 additions & 0 deletions examples/user_interfaces/reconfigurable_toolbar_gtk3.py
@@ -0,0 +1,38 @@
import matplotlib
matplotlib.use('GTK3Agg')
matplotlib.rcParams['backend.single_window'] = True
import matplotlib.pyplot as plt
from matplotlib.backend_bases import ToolBase
import numpy as np

x = np.arange(100)
#Create 4 figures
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
ax1.plot(x, x)


###################
#Toolbar management

#Lets reorder the buttons in the fig3-fig4 toolbar
#Back? who needs back? my mom always told me, don't look back,
fig1.canvas.manager.toolbar.remove_tool(1)

#Move home somewhere nicer
fig1.canvas.manager.toolbar.move_tool(0, 8)


class SampleNonGuiTool(ToolBase):
text = 'Stats'

def set_figures(self, *figures):
#stupid routine that says how many axes are in each figure
for figure in figures:
title = figure.canvas.get_window_title()
print('Figure "%s": Has %d axes' % (title, len(figure.axes)))

#Add simple SampleNonGuiTool to the toolbar of fig1-fig2
fig1.canvas.manager.toolbar.add_tool(SampleNonGuiTool)

plt.show()