How To Create A Graphical Application
Posted by: Luke in software, tags: exe file, google, google search, graphical applications, graphical user interface, images windows, languages, linux, lua, mac os x, os x, productivity, python, shell, simplest thing, tcl tk, text documents, two ways, vroom, windowing systemDesigning graphical applications can be tricky. When a program uses more than text — has images, windows, buttons, etc. — it has a Graphical User Interface. The Message Flasher I wrote recently is an example, yet it has the advantage of being written in TCL/TK. This makes it a breeze to write and understand, relatively speaking.
TCL/TK is a combination of TCL (a simple-to-learn scripting language) and TK (an extension that lets you access the windowing system and do graphical stuff). TK can be used in other languages too. Python, Perl, Lua, and C++ all have versions of TK available for them. To edit text documents, I like to use an editor named vroom that is written in Python’s version of TK, known as Tkinter.
TCL’s version of TK is probably the best documented and supported, which is why I used it to make Message Flasher. Over at wiki.tcl.tk you will find thousands of user-written articles on how to do pretty much anything in TCL/TK. In fact, if you do a google search to find what you’re looking for in TK, that’s the site that will most likely come up.
The version of TCL/TK that is most common is called “wish”. This is short for “WIndowing SHell” and comes pre-installed on Mac OS X and Linux. So the simplest thing is to take the .tcl file and type “wish myprog.tcl“.
Unfortunately, not every system is going to have wish pre-installed. For example, Windows. Furthermore, not every user is competent enough to figure out how to run the script as a wish application. (It may open up in a text editor instead, for example.) Besides which, there’s something convenient about just double-clicking a .exe file and having it run.
With TCL/TK, there are two ways to do this, one of which is long and complicated and one of which is easy. The complicated way is to create a “starkit” and wrap that using TclKit. The other way (better in my opinion) is to use freewrap to wrap your script, quick and easy.
Freewrap will create an executable for Linux or Windows, although it can also be used as a stand-alone interpreter (just like TclKit). Also, because it has winico installed, certain advanced features like customizing the icon and putting your app in the system tray (lower-right corner of the screen) are also easily possible.
In the future, I plan to extend my Message Flasher to the point where it is more easily and intuitively controlled by the user. I have been working on this a lot for the past few days — which is why some of my posts have been late.
When I have all the kinks in this new version worked out, I will release the .exe file for free download.
There will be one catch with this new version: to get the free exe, you must submit your email address. This gives me a legitimate reason to email you from time to time. The source code will still be freely available and public domain.
Related posts:













September 20th, 2008 at 4:49 am - Edit
Nice article, message flasher looks like a neat bit of kit.