8000 updated embedding_in_wx · matplotlib/matplotlib@ecd0fd6 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit ecd0fd6

Browse files
committed
updated embedding_in_wx
svn path=/trunk/matplotlib/; revision=122
1 parent 5a58c88 commit ecd0fd6

File tree

2 files changed

+29
-31
lines changed

2 files changed

+29
-31
lines changed

LICENSE

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LICENSE AGREEMENT FOR MATPLOTLIB 0.42.2
1+
LICENSE AGREEMENT FOR MATPLOTLIB 0.50b
22
--------------------------------------
33

44
1. This LICENSE AGREEMENT is between the John D. Hunter ("JDH"), and
@@ -9,30 +9,30 @@ documentation.
99
2. Subject to the terms and conditions of this License Agreement, JDH
1010
hereby grants Licensee a nonexclusive, royalty-free, world-wide
1111
license to reproduce, analyze, test, perform and/or display publicly,
12-
prepare derivative works, distribute, and otherwise use matplotlib 0.42.2
12+
prepare derivative works, distribute, and otherwise use matplotlib 0.50b
1313
alone or in any derivative version, provided, however, that JDH's
1414
License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
1515
2002, 2003 John D. Hunter; All Rights Reserved" are retained in
16-
matplotlib 0.42.2 alone or in any derivative version prepared by
16+
matplotlib 0.50b alone or in any derivative version prepared by
1717
Licensee.
1818

1919
3. In the event Licensee prepares a derivative work that is based on
20-
or incorporates matplotlib 0.42.2 or any part thereof, and wants to make
20+
or incorporates matplotlib 0.50b or any part thereof, and wants to make
2121
the derivative work available to others as provided herein, then
2222
Licensee hereby agrees to include in any such work a brief summary of
23-
the changes made to matplotlib 0.42.2.
23+
the changes made to matplotlib 0.50b.
2424

25-
4. JDH is making matplotlib 0.42.2 available to Licensee on an "AS IS"
25+
4. JDH is making matplotlib 0.50b available to Licensee on an "AS IS"
2626
basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
2727
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
2828
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
29-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.42.2 WILL NOT
29+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.50b WILL NOT
3030
INFRINGE ANY THIRD PARTY RIGHTS.
3131

3232
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF
33-
MATPLOTLIB 0.42.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES
33+
MATPLOTLIB 0.50b FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES
3434
OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
35-
MATPLOTLIB 0.42.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
35+
MATPLOTLIB 0.50b, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
3636
POSSIBILITY THEREOF.
3737

3838
6. This License Agreement will automatically terminate upon a material
@@ -44,6 +44,6 @@ Licensee. This License Agreement does not grant permission to use JDH
4444
trademarks or trade name in a trademark sense to endorse or promote
4545
products or services of Licensee, or any third party.
4646

47-
8. By copying, installing or otherwise using matplotlib 0.42.2, Licensee
47+
8. By copying, installing or otherwise using matplotlib 0.50b, Licensee
4848
agrees to be bound by the terms and conditions of this License
4949
Agreement.

examples/embedding_in_wx.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,42 @@
3636
figure resizable or not.
3737
"""
3838

39-
import matplotlib
40-
matplotlib.use('WX')
41-
42-
from matplotlib.backends import Figure, Toolbar, FigureManager
39+
40+
from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\
41+
FigureManager
42+
43+
from matplotlib.figure import Figure
4344
from matplotlib.axes import Subplot
4445
import Numeric as numpy
45-
4646
from wxPython.wx import *
47+
48+
4749

4850
class PlotFigure(wxFrame):
4951
def __init__(self):
5052
wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
51-
self.fig = Figure(self, -1, (5,4), 75)
52-
self.toolbar = Toolbar(self.fig)
53+
54+
self.fig = Figure((5,4), 75)
55+
self.canvas = FigureCanvasWx(self, -1, self.fig)
56+
self.toolbar = Toolbar(self.canvas)
5357
self.toolbar.Realize()
5458

55-
# On Windows, default frame size behaviour is incorrect
59+
# On Windows, default frame size behaviour is incorrect
5660
# you don't need this under Linux
5761
tw, th = self.toolbar.GetSizeTuple()
58-
fw, fh = self.fig.GetSizeTuple()
62+
fw, fh = self.canvas.GetSizeTuple()
5963
self.toolbar.SetSize(wxSize(fw, th))
60-
64+
6165
# Create a figure manager to manage things
62-
self.figmgr = FigureManager(self.fig, 1, self)
63-
66+
self.figmgr = FigureManager(self.canvas, 1, self)
6467
# Now put all into a sizer
6568
sizer = wxBoxSizer(wxVERTICAL)
66-
# This way of adding to sizer prevents resizing
67-
#sizer.Add(self.fig, 0, wxLEFT|wxTOP)
68-
69-
# This way of adding to sizer allows resizing
70-
sizer.Add(self.fig, 1, wxLEFT|wxTOP|wxGROW)
71-
72-
# Best to allow the toolbar to resize!
69+
# This way of adding to sizer allows resizing
70+
sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
71+
# Best to allow the toolbar to resize!
7372
sizer.Add(self.toolbar, 0, wxGROW)
7473
self.SetSizer(sizer)
7574
self.Fit()
76-
7775
def plot_data(self):
7876
# Use ths line if using a toolbar
7977
a = self.figmgr.add_subplot(111)
@@ -94,7 +92,7 @@ def GetToolBar(self):
9492
return self.toolbar
9593

9694
if __name__ == '__main__':
97-
app = wxPySimpleApp()
95+
app = wxPySimpleApp(0)
9896
frame = PlotFigure()
9997
frame.plot_data()
10098
frame.Show()

0 commit comments

Comments
 (0)
0