We’ve spent a bit of time lately revisiting Tcl/Tk like with Tcl/Tk Bats and Ball Tutorial as shown below, from a couple of different fronts …
- The raw Tcl involving Tk code unit testing arrangements on Mac OS X Yosemite
- Interfacing Tcl/Tk with C++ and the Xcode IDE using Mac OS X Yosemite
… and it is sad that we have to say “Mac OS X Yosemite” so much above, but, alas, that is the weakness of the Tk GUI aspect to Tcl/Tk … it is quite platform dependant for the GUI look of it.
But though we dedicated much more time to it back at Mac OS X 10.5 Leopard, and with Windows XP, and we were finding ways to integrate code across these two with Xcode and Visual Studio IDE usage, that seems a while away now, without a lot more time dedicated to this purpose. However, did get the Xcode and C++ code going for a Draw Poker card game, but got let down by the “Tk” bits of the innards of this no longer looking good with Mac OS X 10.10 Yosemite.
You see, when we were getting somewhere (further), what we used to do was create the vast bulk of GUI “Tk” functionality, as a separate “unit testable” tcl extension file you could test at the command line for Tcl code like today’s crossword.tcl via one of the three application Terminal command line statements …
- tclsh ./crossword.tcl
- wish ./crossword.tcl
- chmod 755 crossword.tcl ; ./crossword.tcl
… and once you were happy with this unit test, the “business logic” of these Tcl/Tk files could easily be incorporated into an Xcode C++ (or Visual Studio C++) project “ourtcl.h” header file to be enveloped by the rest of the way Tcl/Tk framework can interface to the C++ language.
So that is one idea of a way to go, we think, should you be interested in pursuing this yourself as a GUI desktop application approach to creating Tcl/Tk applications. In addition, I’d still be reading lots of the net, like that list we included in that previous Tcl/Tk Bats and Ball Tutorial.
Stop Press
This tutorial’s crossword.tcl work was done on this MacBook Pro laptop. Thought I’d test it on RJM Programming’s web server, where there is a Tclsh shell interface but got …
# ./crossword.tcl
no display name and no $DISPLAY environment variable
while executing
"load /usr/lib64/tk8.5/../libtk8.5.so Tk"
("package ifneeded Tk 8.5.7" script)
invoked from within
"package require Tk"
(file "./crossword.tcl" line 6)
# exit
logout
… which relates to, these days …
- versions of Tcl and/or Tk “keeping up” … and …
- using XQuartz rather than the X11 of the old Mac OS X Leopard days … which you can read about more at those links of Tcl/Tk Bats and Ball Tutorial
Previous relevant Tcl/Tk Bats and Ball Tutorial is shown below.
Good news today is a breakthrough on a put-off project, getting Tcl/Tk to work with Mac OS X Mavericks and Xcode 5.1 on a MacBook Pro laptop … answering, partially, the previous Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial lament … yayyyyyyyyyyyyyy!
Was a bit of a battle combining environmental issues and coding issues, and there is an ongoing unresolved (ease of) deployment issue (with Mavericks (ie. Mac OS X 10.9) … lead is Homebrew (what happened to the excellent Package Manager?!)).
Think Tcl/Tk is definitely worth the time to try GUI applications, which we do here with Xcode C++ code, which utitizes Tcl scripting and Tk GUI.
The environmental requirements to get it up and running (again … had it working quite a long time ago (with Mac OS X Darwin or one up from this … see below it was Mac OS X 10.5.8/Xcode 3.0)) revolved around updating (personally, had to start again with a full reinstall) Macports.
The coding issues revolved around a Mac OS X alternative to gettimeofday() function and the 64-bit architecture of a modern Macbook Pro laptop.
Today’s Mac OS X Mavericks application built with Xcode 5,1 is a Bats and Ball game with up to four players (4 players/1 keyboard = twister?) reminiscent of those twee tennis games you used to play in the foyer before playing a squash game, back in the ’70s … please don’t do the maths!
If you would like this application for a Mavericks Mac maybe an ad-hoc style of install could be arranged if you drop me an email.
Please enjoy today’s Tcl/Tk tutorial made up of two visual parts … “twirling” around bottom of picture above, and clicking for a video.
These links were useful (so, thanks):
- Mac OS X install error: No available formula for gtest – ROS Answers: Open Source Q&A Forum
- OS X- How can I create an OS 10.9 Mavericks .dmg?: [ Apple ]
- X112.7.5 – XQuartz
- Installing Homebrew on OS X Mavericks 10.9, Package Manager for Unix Apps
- MacOS Mavericks Fix, Package Manager, etc.
- The state of package management on Mac OS X | On the lambda
- Retrieving system time: gettimeofday()
- osx – Can’t update Macports (with Mac OS X Mavericks) – Stack Overflow
- How to Install Command Line Tools in 10.9 Mavericks Fresh Install
- Macports Download page
- Can’t run a TCL script on CentOS 5.8
Tcl scripts can run on many web servers, and the web server this domain runs on accepts Tcl scripts run from the command line. Take a look at this simple Tcl programming script inspired by that last link above, which can be called HelloWorld.tcl and runs at the web server’s command line via tclsh ./HelloWorld.tcl … this can be a web application via PHP exec command which you can see with HelloWorld.php and with this live run. Tcl scripts are interpreted, unlike our Bats And Ball compiled code, so you would have to compile the code at the web server with a similar environment to successfully deploy Bats And Ball to a Linux web server, this way.
Link to Tcl/Tk website … Home of Tcl/Tk
Link to Tcl/Tk jobs done … Tcl/Tk jobs done … personal experience
Previous relevant Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial is shown below.
Have you heard of Tcl/Tk?
Tcl/Tk is open source (based on a BSD-style license), so you can use it and modify it virtually any way you want, including for commercial uses.
With Tcl/Tk have used in conjunction with C++ and Python (look out for Tkinter).
Use it for Games Programming (it makes pretty cute GUIs … you may disagree?!) and it used to work back at Mac OS X 10.5.8/XCode 3.0 (am going to try Mac OS X 10.7.5 … any advice anywhere?) and had it going on Windows XP with Visual Studio Express as well. It has a lot of cross-platform strengths.
Think Tcl/Tk is really really good.
In this primer tutorial you can see a Draw Poker game as an XCode project, see it Build and in action, then see how to arrange for *.dmg Package Distribution via Package Manager.
Link to Tcl/Tk website … Home of Tcl/Tk … where quote up the top resides
Link to Tcl/Tk jobs done … Tcl/Tk jobs done … personal experience
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.