[Pythonmac-SIG] ANNOUNCE: Tcl/Tk for Mac OS X (fwd)

Tony Lownds tony@metanet.com
Mon, 15 Oct 2001 18:30:30 -0700


--============_-1208926656==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

I've had some initial success compiling Tkinter by following this recipe:


1. download and install as per below:

>
>I also put a binary snapshot of Wish and the Tcl & Tk Frameworks in
>the SourceForge release, under the package name "Mac OS X Tk
>Snapshots".  You can get to this by looking at the page:
>
>http://sourceforge.net/projects/tcl/
>
>and look for Latest File Releases.  Probably should have put this in
>the Tk site instead, Doh!  I am just getting used to SourceForge.

2. sudo tar -zxf MacOSXTk8.4a4.tar.gz -C /

3. checkout the tk sources

4. cp -r tk/xlib/X11 /Library/Frameworks/Tk.framework/Headers/

5. go to your freshly compiled CVS checkout of Python: cd python/dist/src
I used ./configure --with-suffix=.exe --enable-framework

6. cat > Setup.local

# Edit this file for local setup changes

*shared*

_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
         -framework Tcl -framework Tk \
         -I/Library/Frameworks/Tcl.framework/Headers/ \
         -I/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders/ \
         -I/Library/Frameworks/Tk.framework/Headers/ \
         -I/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders/
^D

7. make

8. ./python.exe Demo/tkinter/guido/hello.py


I'm posting this in the hope that others can make the process better.

-Tony

>
>SO HOW DO I USE THIS STUFF:
>
>========================================
>First for the binaries... 
>
>The snapshot is just a gzipped tar file, that has the structure:
>
>Applications/Wish Shell.app
>    ...
>Library/Frameworks/Tcl.framework
>    ...
>Library/Frameworks/Tk.framework
>    ...
>
>So you can either untar this in / - to make an installation that is
>available to all users on your machine, or in ~ to make one useable
>only to you.  In any case, just double-click on Wish Shell.app to get
>started.  You will probably also want to change the files to
>make them owned by you...
>
>In fact, you can move things around even more than this.  The Frameworks
>just need to be in one of the system paths (/Library/Frameworks,
>/System/Library/Frameworks, or ~/Library/Frameworks) to be found
>automatically by dyld.  Or you can put them somewhere else and set
>DYLD_FRAMEWORK_PATH to point to that location.
>
>After that, you can put "Wish Shell.app" pretty much anywhere you
>want.
>
>One other little trick about the "Wish Shell.app" that may come in
>handy.  If you put a file called "AppMain.tcl" inside the "Wish
>Shell.app" package, in the folder:
>
>Wish Shell.app/Contents/Resources/Scripts
>
>then that will be sourced in as if you had given it as the first
>argument on the command-line in Unix, or equivalently had made a D&D
>Tclet with that file on the Mac.  The Mac OS X version goes one
>better, because the Scripts directory is also added to the auto_path,
>so you can put your script libraries there, and they will be found as
>well.
>
>The "Wish Shell.app" uses the same console that the Windows & Mac
>ports use.  However, if you want to use a terminal console for some
>reason, then just do:
>
>$ ./Wish Shell.app/Contents/MacOS/Wish Shell"
>
>in Terminal.app, and it will use the Terminal window instead of the Tk
>based one.
>
>There is some support for the Custom MDEF that Tk used on MacOS X, but
>it is pretty rough right now, so I have turned it off by default.  If
>you want to play with this, do:
>
>set ::tk::mac::useCustomMDEF 1
>
>somewhere BEFORE you create your menus, it will only affect
>menus made after you change the setting.  The default setting is done
>at the end of tk.tcl in the Resources/Scripts folder in the Tk
>framework, so you can also just reverse this setting there to make
>Wish always use the custom MDEF.
>
>These binaries were built on Mac OS X - 10.1.  There is no obvious reason
>why they wouldn't run on 10.0, but I haven't run that in quite a long
>time, so I won't guarantee there aren't any little hitches.  10.1 is SO
>much nicer than 10.0, however, that I am not inclined to spend much time
>supporting it.
>
>========================================
>Next the source:
>
>As I said, the sources are on the SourceForge CVS repositories, the
>branch name is macosx-8-4-branch.  The projects expect tcl & tk to be
>in the same folder, so like:
>
>./source
>     source/tcl
>     source/tk
>
>If they are not set up like this, you will have to go muck with the
>include paths in the project.
>
>Tcl:
>
>On the Tcl side, there aren't many changes.  I added a MacOS X
>directory, but all it contains at present is a Project Builder project
>that will build Tcl in the way that Wish currently expects it to be
>built.  You can also build the Tcl in this distribution with the
>standard configure/make.  But I haven't added the ability to
>auto-magically build the Framework from the Makefile.  That is what
>the PB Project is for.
>
>The one special thing to note is that Wish requires that you build
>the --enable-thread version of Tcl.  I haven't put in any checks to
>make sure you do this yet, but it will fail pretty much straight off
>the bat if you don't, so...  This was required to wait on Tcl "select"
>based sources and still keep Carbon waiting on the App Main Thread as
>Ed intended.
>
>I also want to migrate the AppleScript and Resource goodies from the
>Classic Mac side to MacOS X, and also add an interface to the CFBundle
>API's (which I am now using hackily in tclUnixInit.c).  But I haven't
>gotten around to that yet.
>
>Tk:
>
>Tk has the majority of the changes, as you would expect.  There are
>not any really substantial changes in the generic folder, there are
>some in the library code, mostly because a lot of it assumes
>tcl_platform(platform) == unix means you are using X11, which is not
>the case for MacOS X. 
>
>Other that that, the code in the macosx folder is the interesting
>bits.  It is a pretty straight Carbonization of the Classic Mac code,
>but I also took advantage of the opportunity to toss alot of the cruft
>from supporting earlier versions of MacOS, and to rework the code to
>be a little more to my liking.
>
>I didn't try to rework the Unix Makefiles to support building Wish on
>MacOS X.  In part this was because there weren't many similarities
>between the Unix & Mac OS X Makefiles, but mostly because I wanted to
>use Project Builder, since I actually like GUI development
>environments.  If someone with the opposite bent wants to hack up some
>Makefiles, I would be happy to accept the changes.
>
>The only trick to building Tcl & Wish is to set the Product
>directories for the Tcl.pbproj and Wish.pbproj to the same directory
>(either in the PB Global preferences, or in the super-secret Project
>specific preferences that you find by selecting the Project entry in
>the File tree, and doing "Show Info".)  Then build the topmost Tcl
>agregate target, and then build the Wish Target.
>
>In a couple of days I will get together a list of "current and future
>projects" in case anyone is interested in helping.  There is a SourceForge
>task manager that should be a good venue for this.  There is lots of fun
>stuff still to do, by the way, including converting from QuickDraw to
>CoreGraphics for the low-level drawing code - so we can get nice looking
>line drawing onthe canvas, finally...  And using ATSUI, so we can get the
>sweet anti-aliased fonts.
>
>Extensions:
>
>To tell the truth, I only started playing around seriously with
>packaging all this stuff up in Frameworks & App Packages in the past
>couple of weeks.  I think the structure offers a lot of promise, but I
>haven't worked on porting extensions yet, so there will probably be
>some refinements to make this easier as time goes on. 
>
>If you have a standard Tcl (not Tk) extension, the way Tcl.pbproj
>builds things is a pretty good model.  It shows how to build
>frameworks from a Makefile based approach without having to hack up
>your Makefiles too badly.
>
>I would like to figure out a way to do this more generally within the
>TEA structure, while still getting to use PB, and inflicting the least
>pain on other extension writers.  But I've only just started thinking
>about this part.
>
>Well, there are probably a lot more little stumbling blocks that I am
>forgetting, but it is late, and I am sure you will all remind me of
>them in due course.
>
>One thing I can't omit, however, is a big THANKS to Apple, who let me
>work with this in spite of my having another day job, to Dave Payne,
>my manager, who supported this project even when gdb needed all the
>coddling we could give it, to Sergio Mello from Apple DTS who found
>the resources to hire Ian Reid to help out with this for the past 6
>months, and to Ian, who did all the dog work while I mostly got to say
>"Well, I think it should work like..." 
>
>Sometimes it even did...
>
>Jim Ingham
>Apple Computer, Inc.
>
>- --
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
>Jim Ingham                            jingham@apple.com
>Developer Tools - gdb
>
>[[Send Tcl/Tk announcements to tcl-announce@mitchell.org
>   Send administrivia to tcl-announce-request@mitchell.org
>   Announcements archived at http://groups.yahoo.com/group/tcl_announce/
>   The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/ ]]
>
>- ------- end of forwarded message -------
>
>- --
>
>Cameron Laird <claird@NeoSoft.com>
>Business:  http://www.Phaseit.net
>Personal:  http://starbase.neosoft.com/~claird/home.html
>
>------- End of Forwarded Message
>
>_______________________________________________
>Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig


-- 
--============_-1208926656==_ma============
Content-Type: text/html; charset="us-ascii"

<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: [Pythonmac-SIG] ANNOUNCE: Tcl/Tk for Mac OS X
(fwd</title></head><body>
<div>I've had some initial success compiling Tkinter by following this
recipe:</div>
<div><br></div>
<div><br></div>
<div>1. download and install as per below:</div>
<div><br></div>
<blockquote type="cite" cite><br>
I also put a binary snapshot of Wish and the Tcl &amp; Tk Frameworks
in<br>
the SourceForge release, under the package name &quot;Mac OS X Tk<br>
Snapshots&quot;.&nbsp; You can get to this by looking at the page:<br>
<br>
http://sourceforge.net/projects/tcl/<br>
<br>
and look for Latest File Releases.&nbsp; Probably should have put this
in<br>
the Tk site instead, Doh!&nbsp; I am just getting used to
SourceForge.</blockquote>
<div><br></div>
<div>2. sudo tar -zxf<font face="Lucida Grande" size="+2"
color="#000000"> MacOSXTk8.4a4.tar.gz</font> -C /</div>
<div><br></div>
<div>3. checkout the tk sources</div>
<div><br></div>
<div>4. cp -r tk/xlib/X11
/Library/Frameworks/Tk.framework/Headers/</div>
<div><br></div>
<div>5. go to your freshly compiled CVS checkout of Python: cd
python/dist/src</div>
<div>I used ./configure --with-suffix=.exe --enable-framework</div>
<div><br></div>
<div>6. cat &gt; Setup.local</div>
<div><br></div>
<div># Edit this file for local setup changes<br>
<br>
*shared*<br>
<br>
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -framework Tcl -framework
Tk \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-I/Library/Frameworks/Tcl.framework/Headers/ \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-I/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders/
\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-I/Library/Frameworks/Tk.framework/Headers/ \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-I/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders/</div
>
<div>^D</div>
<div><br></div>
<div>7. make</div>
<div><br></div>
<div>8. ./python.exe Demo/tkinter/guido/hello.py</div>
<div><br></div>
<div><br></div>
<div>I'm posting this in the hope that others can make the process
better.</div>
<div><br></div>
<div>-Tony</div>
<div><br></div>
<blockquote type="cite" cite><br>
SO HOW DO I USE THIS STUFF:<br>
<br>
========================================<br>
First for the binaries...&nbsp;<br>
<br>
The snapshot is just a gzipped tar file, that has the structure:<br>
<br>
Applications/Wish Shell.app<br>
&nbsp;&nbsp; ...<br>
Library/Frameworks/Tcl.framework<br>
&nbsp;&nbsp; ...<br>
Library/Frameworks/Tk.framework<br>
&nbsp;&nbsp; ...<br>
<br>
So you can either untar this in / - to make an installation that
is<br>
available to all users on your machine, or in ~ to make one
useable<br>
only to you.&nbsp; In any case, just double-click on Wish Shell.app to
get<br>
started.&nbsp; You will probably also want to change the files to<br>
make them owned by you...<br>
<br>
In fact, you can move things around even more than this.&nbsp; The
Frameworks<br>
just need to be in one of the system paths (/Library/Frameworks,<br>
/System/Library/Frameworks, or ~/Library/Frameworks) to be found<br>
automatically by dyld.&nbsp; Or you can put them somewhere else and
set<br>
DYLD_FRAMEWORK_PATH to point to that location.<br>
<br>
After that, you can put &quot;Wish Shell.app&quot; pretty much
anywhere you<br>
want.<br>
<br>
One other little trick about the &quot;Wish Shell.app&quot; that may
come in<br>
handy.&nbsp; If you put a file called &quot;AppMain.tcl&quot; inside
the &quot;Wish<br>
Shell.app&quot; package, in the folder:<br>
<br>
Wish Shell.app/Contents/Resources/Scripts<br>
<br>
then that will be sourced in as if you had given it as the first<br>
argument on the command-line in Unix, or equivalently had made a
D&amp;D<br>
Tclet with that file on the Mac.&nbsp; The Mac OS X version goes
one<br>
better, because the Scripts directory is also added to the
auto_path,<br>
so you can put your script libraries there, and they will be found
as<br>
well.<br>
<br>
The &quot;Wish Shell.app&quot; uses the same console that the Windows
&amp; Mac<br>
ports use.&nbsp; However, if you want to use a terminal console for
some<br>
reason, then just do:<br>
<br>
$ ./Wish Shell.app/Contents/MacOS/Wish Shell&quot;<br>
<br>
in Terminal.app, and it will use the Terminal window instead of the
Tk<br>
based one.<br>
<br>
There is some support for the Custom MDEF that Tk used on MacOS X,
but<br>
it is pretty rough right now, so I have turned it off by default.&nbsp;
If<br>
you want to play with this, do:<br>
<br>
set ::tk::mac::useCustomMDEF 1<br>
<br>
somewhere BEFORE you create your menus, it will only affect<br>
menus made after you change the setting.&nbsp; The default setting is
done<br>
at the end of tk.tcl in the Resources/Scripts folder in the Tk<br>
framework, so you can also just reverse this setting there to make<br>
Wish always use the custom MDEF.<br>
<br>
These binaries were built on Mac OS X - 10.1.&nbsp; There is no
obvious reason<br>
why they wouldn't run on 10.0, but I haven't run that in quite a
long<br>
time, so I won't guarantee there aren't any little hitches.&nbsp; 10.1
is SO<br>
much nicer than 10.0, however, that I am not inclined to spend much
time<br>
supporting it.<br>
<br>
========================================</blockquote>
<blockquote type="cite" cite>Next the source:<br>
<br>
As I said, the sources are on the SourceForge CVS repositories,
the<br>
branch name is macosx-8-4-branch.&nbsp; The projects expect tcl &amp;
tk to be<br>
in the same folder, so like:<br>
<br>
./source<br>
&nbsp;&nbsp;&nbsp; source/tcl<br>
&nbsp;&nbsp;&nbsp; source/tk<br>
<br>
If they are not set up like this, you will have to go muck with
the<br>
include paths in the project.<br>
<br>
Tcl:<br>
<br>
On the Tcl side, there aren't many changes.&nbsp; I added a MacOS
X<br>
directory, but all it contains at present is a Project Builder
project<br>
that will build Tcl in the way that Wish currently expects it to
be<br>
built.&nbsp; You can also build the Tcl in this distribution with
the<br>
standard configure/make.&nbsp; But I haven't added the ability to<br>
auto-magically build the Framework from the Makefile.&nbsp; That is
what<br>
the PB Project is for.<br>
<br>
The one special thing to note is that Wish requires that you build<br>
the --enable-thread version of Tcl.&nbsp; I haven't put in any checks
to<br>
make sure you do this yet, but it will fail pretty much straight
off<br>
the bat if you don't, so...&nbsp; This was required to wait on Tcl
&quot;select&quot;<br>
based sources and still keep Carbon waiting on the App Main Thread
as<br>
Ed intended.<br>
<br>
I also want to migrate the AppleScript and Resource goodies from
the<br>
Classic Mac side to MacOS X, and also add an interface to the
CFBundle<br>
API's (which I am now using hackily in tclUnixInit.c).&nbsp; But I
haven't<br>
gotten around to that yet.<br>
<br>
Tk:<br>
<br>
Tk has the majority of the changes, as you would expect.&nbsp; There
are<br>
not any really substantial changes in the generic folder, there
are<br>
some in the library code, mostly because a lot of it assumes<br>
tcl_platform(platform) == unix means you are using X11, which is
not<br>
the case for MacOS X.&nbsp;<br>
<br>
Other that that, the code in the macosx folder is the interesting<br>
bits.&nbsp; It is a pretty straight Carbonization of the Classic Mac
code,<br>
but I also took advantage of the opportunity to toss alot of the
cruft<br>
from supporting earlier versions of MacOS, and to rework the code
to<br>
be a little more to my liking.<br>
<br>
I didn't try to rework the Unix Makefiles to support building Wish
on<br>
MacOS X.&nbsp; In part this was because there weren't many
similarities<br>
between the Unix &amp; Mac OS X Makefiles, but mostly because I wanted
to<br>
use Project Builder, since I actually like GUI development<br>
environments.&nbsp; If someone with the opposite bent wants to hack up
some<br>
Makefiles, I would be happy to accept the changes.<br>
<br>
The only trick to building Tcl &amp; Wish is to set the Product<br>
directories for the Tcl.pbproj and Wish.pbproj to the same
directory<br>
(either in the PB Global preferences, or in the super-secret
Project<br>
specific preferences that you find by selecting the Project entry
in<br>
the File tree, and doing &quot;Show Info&quot;.)&nbsp; Then build the
topmost Tcl<br>
agregate target, and then build the Wish Target.<br>
<br>
In a couple of days I will get together a list of &quot;current and
future<br>
projects&quot; in case anyone is interested in helping.&nbsp; There is
a SourceForge<br>
task manager that should be a good venue for this.&nbsp; There is lots
of fun<br>
stuff still to do, by the way, including converting from QuickDraw
to<br>
CoreGraphics for the low-level drawing code - so we can get nice
looking<br>
line drawing onthe canvas, finally...&nbsp; And using ATSUI, so we can
get the<br>
sweet anti-aliased fonts.<br>
<br>
Extensions:<br>
<br>
To tell the truth, I only started playing around seriously with<br>
packaging all this stuff up in Frameworks &amp; App Packages in the
past<br>
couple of weeks.&nbsp; I think the structure offers a lot of promise,
but I<br>
haven't worked on porting extensions yet, so there will probably
be<br>
some refinements to make this easier as time goes on.&nbsp;<br>
<br>
If you have a standard Tcl (not Tk) extension, the way Tcl.pbproj<br>
builds things is a pretty good model.&nbsp; It shows how to build<br>
frameworks from a Makefile based approach without having to hack
up<br>
your Makefiles too badly.<br>
<br>
I would like to figure out a way to do this more generally within
the<br>
TEA structure, while still getting to use PB, and inflicting the
least<br>
pain on other extension writers.&nbsp; But I've only just started
thinking<br>
about this part.<br>
<br>
Well, there are probably a lot more little stumbling blocks that I
am<br>
forgetting, but it is late, and I am sure you will all remind me
of</blockquote>
<blockquote type="cite" cite>them in due course.<br>
</blockquote>
<blockquote type="cite" cite>One thing I can't omit, however, is a big
THANKS to Apple, who let me<br>
work with this in spite of my having another day job, to Dave
Payne,<br>
my manager, who supported this project even when gdb needed all
the<br>
coddling we could give it, to Sergio Mello from Apple DTS who
found<br>
the resources to hire Ian Reid to help out with this for the past
6<br>
months, and to Ian, who did all the dog work while I mostly got to
say</blockquote>
<blockquote type="cite" cite>&quot;Well, I think it should work
like...&quot;&nbsp;<br>
<br>
Sometimes it even did...<br>
<br>
Jim Ingham<br>
Apple Computer, Inc.<br>
<br>
- --<br>
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+<br>
Jim
Ingham&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
></span
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jingham@apple.com<br>
Developer Tools - gdb<br>
<br>
[[Send Tcl/Tk announcements to tcl-announce@mitchell.org<br>
&nbsp; Send administrivia to tcl-announce-request@mitchell.org<br>
&nbsp; Announcements archived at
http://groups.yahoo.com/group/tcl_announce/<br>
&nbsp; The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/
]]<br>
<br>
- ------- end of forwarded message -------<br>
<br>
- --<br>
<br>
Cameron Laird &lt;claird@NeoSoft.com&gt;<br>
Business:&nbsp; http://www.Phaseit.net<br>
Personal:&nbsp; http://starbase.neosoft.com/~claird/home.html<br>
<br>
------- End of Forwarded Message<br>
<br>
_______________________________________________<br>
Pythonmac-SIG maillist&nbsp; -&nbsp; Pythonmac-SIG@python.org<br>
http://mail.python.org/mailman/listinfo/pythonmac-sig</blockquote>
<div><br></div>
<div><br></div>
<x-sigsep><pre>-- 
</pre></x-sigsep>
</body>
</html>
--============_-1208926656==_ma============--