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

Skip to content

Commit d7ec8da

Browse files
committed
fixed tk framework for os x
svn path=/trunk/matplotlib/; revision=403
1 parent e1b8eca commit d7ec8da

5 files changed

Lines changed: 64 additions & 12 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
New entries should be added at the top
22

3+
2004-07-16 Added ps/eps/svg savefig options to wx and gtk JDH
4+
5+
2004-07-15 Fixed python framework tk finder in setupext.py - JDH
6+
37
2004-07-14 Fixed layer images demo which was broken by the 07/12 image
48
extent fixes - JDH
59

TODO

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,5 @@
467467

468468
-- layer images broken
469469

470+
-- font dict in wx is broken w/ respect to new font names
471+

examples/embedding_in_wx2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ def __init__(self):
3939

4040
self.sizer = wxBoxSizer(wxVERTICAL)
4141
self.sizer.Add(self.canvas, 1, wxTOP | wxLEFT | wxEXPAND)
42+
self.SetSizer(self.sizer)
43+
self.Fit()
4244

43-
#self.add_toolbar() # comment this out for no toolbar
45+
self.add_toolbar() # comment this out for no toolbar
4446

4547

4648
# Capture the paint message

examples/simple_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
title('About as simple as it gets, folks')
1313
grid(True)
1414
#axis([0,1,-1,1])
15-
savefig('simple_plot')
15+
#savefig('simple_plot')
1616

1717
show()

setupext.py

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
'linux2' : ['/usr/local', '/usr',],
3737
'linux' : ['/usr/local', '/usr',],
3838
'darwin' : [os.getenv('MPLIB_BASE') or '/usr/local', '/usr', '/sw'],
39-
'freebsd4' : [os.getenv('MBLIB_BASE') or '/usr/local', '/usr'],
39+
'freebsd4' : [os.getenv('MPLIB_BASE') or '/usr/local', '/usr'],
4040
'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
4141
}
4242

@@ -212,15 +212,59 @@ def add_tk_flags(module):
212212
module.include_dirs.extend(['win32_static/include/tcl'])
213213
module.library_dirs.extend(['C:/Python23/dlls'])
214214
module.libraries.extend(['tk84', 'tcl84'])
215-
else:
216-
o = find_tcltk()
217-
if sys.platform == 'darwin' and '/Library/Framework' in o.tk_lib:
218-
module.extra_link_args.extend(['-framework','Tcl'])
219-
module.extra_link_args.extend(['-framework','Tk'])
220-
else:
221-
module.include_dirs.extend([o.tcl_inc, o.tk_inc])
222-
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
223-
module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv])
215+
return
216+
217+
elif sys.platform == 'darwin' :
218+
# this config section lifted directly from Imaging - thanks to
219+
# the effbot!
220+
221+
# First test for a MacOSX/darwin framework install
222+
from os.path import join, exists
223+
framework_dirs = [
224+
'/System/Library/Frameworks/',
225+
'/Library/Frameworks',
226+
join(os.getenv('HOME'), '/Library/Frameworks')
227+
]
228+
229+
# Find the directory that contains the Tcl.framwork and Tk.framework
230+
# bundles.
231+
# XXX distutils should support -F!
232+
for F in framework_dirs:
233+
# both Tcl.framework and Tk.framework should be present
234+
for fw in 'Tcl', 'Tk':
235+
if not exists(join(F, fw + '.framework')):
236+
break
237+
else:
238+
# ok, F is now directory with both frameworks. Continure
239+
# building
240+
tk_framework_found = 1
241+
break
242+
if tk_framework_found:
243+
# For 8.4a2, we must add -I options that point inside the Tcl and Tk
244+
# frameworks. In later release we should hopefully be able to pass
245+
# the -F option to gcc, which specifies a framework lookup path.
246+
#
247+
tk_include_dirs = [
248+
join(F, fw + '.framework', H)
249+
for fw in 'Tcl', 'Tk'
250+
for H in 'Headers', 'Versions/Current/PrivateHeaders'
251+
]
252+
253+
# For 8.4a2, the X11 headers are not included. Rather than include a
254+
# complicated search, this is a hard-coded path. It could bail out
255+
# if X11 libs are not found...
256+
# tk_include_dirs.append('/usr/X11R6/include')
257+
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
258+
module.include_dirs.extend(tk_include_dirs)
259+
module.extra_link_args.extend(frameworks)
260+
module.extra_compile_args.extend(frameworks)
261+
return
262+
263+
# you're still here? ok we'll try it this way
264+
o = find_tcltk()
265+
module.include_dirs.extend([o.tcl_inc, o.tk_inc])
266+
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
267+
module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv])
224268

225269

226270
def add_windowing_flags(module):

0 commit comments

Comments
 (0)