One of our “side bar” challenges is developing software solutions (applications) for our clients. Simple or complex, they all have one element in common, a Graphical User Interface or GUI.
Imagine the surprise and disappointment on the faces of many beginning programmers and developers when they discover that powerful languages like Assembler, C, C++, and even Python start by teaching you how to write software from the command prompt!
We’ve been there too! When we decided to learn Python – a powerful, high-level, dynamic interpreted scripting language that is quickly becoming the language of choice for new developers – we were just as surprised to be writing and running programs from the command line (C:\). Even Python’s Interactive Development Environment (IDLE) uses a “prompt” driven interface.
Our journey with Python originated with our interest in learning C++. When we discovered that Python is written in C++, we were curious to see how C++ could be used to create an even more powerful dynamic language.
Learning a language and creating a GUI are related but they are not necessarily the same. Developing an application requires a solid understanding of the core language itself including its capabilities and constraints. A GUI “simply” serves as a means of interacting with the core application without concern for how the program actually functions or performs internally.
By way of analogy, driving a car does not require us to understand the intricate functions of the engine and powertrain. As drivers, we use a key to turn the engine on or off, a gear selector, the accelerator and brake pedals, and the instrument panel – all of which are the equivalent of a GUI in terms of function – to control and monitor the vehicle. As developers, however, we are more concerned with ensuring that the engine and powertrain function as expected. In other words, the GUI can wait but it should still be a consideration during the development process.
Where’s the Graphics?
Is writing applications with a nice, clean, graphical interface a mystery that only professional programmers can master? This answer may surprise you. Anyone can create a GUI and there is yet another language for doing just that: Tcl/Tkinter. Tcl is a general purpose scripting language developed by John Ousterhout in 1988 and was designed to enable communication between applications. Tkinter is a cross platform toolkit that provides a variety of widgets for building GUI’s in many languages.
Most introductory books on Python are concerned with teaching the core fundamentals of the Python language itself, though some may provide a brief introduction to Tkinter. It is significant that Tkinter is included as part of the Python distributions that are freely available for download from the Python.org website. Including Tkinter in the Python distribution enables the development of simple to complex GUI’s for your application.
Back to the Beginning
To fully understand the Tcl/Tk programming language, we decided to search for more information. We discovered an excellent Tcl/Tk Tutorial at TutorialsPoint.com where we are served with a wealth of information for both Tcl and Tk. This is certainly enough to whet your appetite for more.
The TutorialsPoint Tcl/Tk Tutorial describes several features of Tcl and this is one that caught our attention:
“You can easily extend existing applications with Tcl. Also, it is possible to include Tcl in C, C++ or Java to Tcl or vice versa.”
What seems like an overly extended tangent from our original pursuit of C++ has become a worthwhile journey. One of our greatest frustrations while learning C (and C++) was the lack of information for developing a graphical interface for our applications. It looks like we may have discovered something that will help us along the way for a variety of languages.
If you are using an Apple computer, Tk and Python are already installed on your system as part of the OSx. The versions installed depend on the version of OSx you are running on your computer.
We recommend visiting SourceForge.net and searching for the term “Tcl/Tk”, without the quotes, using the site’s search box. You will be presented with the latest version of Tcl (8.6.2) and variety of other related tools including several Tcl extension packages and IDE’s.
To get the latest copy of ActiveState‘s version (18.104.22.168) of Tcl/Tk for your system (Windows, Linux, Mac OSx) visit the ActiveState.com download page. The community version is free and will be more than sufficient to get you started. Click here to see some interesting code snippets or “recipes” on the ActiveState site that demonstrate some of the key features of Tcl/Tk.
We already suggested that TutorialsPoint offers an excellent introduction to Tcl/Tk Programming, however, we have also discovered several books that are worth mentioning to get you started:
- Tcl and Tk Programming for the Absolute Beginner, by Kurt Wall (2007)
- Practical Programming in Tcl and Tk (4th Edition), by Brent Welch and Ken Jones (2003)
- TCL / TK in a Nutshell: A Desktop Quick Reference, by Paul Raines and Jeff Tranter (1999)
- Effective Tcl/Tk Programming: Writing Better Programs with Tcl and Tk, by Mark Harrison and Michael McLennon (1997)
- Tcl/Tk, Third Edition: A Developer’s Guide (The Morgan Kaufmann Series in Software Engineering and Programming), by Clif Flynt (2012)
- Tcl and the Tk Toolkit (2nd Edition), by John K. Ousterhout and Ken Jones (2009)
- Tcl/Tk Pocket Reference, by Paul Raines (1998)
- Tcl 8.5 Network Programming, by by
Python and Tkinter GUI:
- TkDocs.com offers an excellent Tkinter tutorial and is definitely worth reading.
- Tkinter GUI Application Development HOTSHOT, by
- Modern Tkinter for Busy Python Developers, by Mark Roseman
- Python3.3.4 Tkinter/Ttk Widgets and Sqlite3: For Windows and Debian-Linux Includes Source Code, by Herb Norbom (2014)
- Python and Tkinter Programming, by
- Tkinter: Questions and Answers, by George Duckett
- Python Programming & GUI’s: for Electronic Engineers, by Andrew Pratt (2010)
Python and Other GUI’s:
- PySide GUI Application Development, by Venkateshwaran Loganathan (2013)
- Rapid GUI Programming with Python and Qt (Prentice Hall Open Source Software Development), by
C++ and Qt:
- C++ GUI Programming with Qt 4 (2nd Edition) (Prentice Hall Open Source Software Development Series), by
- Advanced Qt Programming: Creating Great Software with C++ and Qt 4 (Prentice Hall Open Source Software Development), by Mark Summerfield (2010)
- Introduction to Design Patterns in C++ with Qt (2nd Edition) (Prentice Hall Open Source Software Development Series), by Alan Ezust and Paul Ezust (2011)
- Application Development with Qt Creator, by Ray Rischpater
While some are comfortable to accept the tools at face value, we found it helpful to delve into the core of Tkinter and Tcl to fully appreciate and understand the underlying language and tools that are available to us.
As Operating Systems continue to compete for market share, it is good to know that we have cross platform GUI options that will allow us to write applications that will work on all of them. To this end, we’re less concerned about “who wins” and more concerned about writing efficient and effective applications for our clients.
Your feedback matters
If you have any comments, questions, or topics you would like us to address, please feel free to leave your comment in the space below or email us at firstname.lastname@example.org or email@example.com. We look forward to hearing from you and thank you for visiting.
Until Next Time – STAY lean
[twitter-follow screen_name=’Versalytics’ show_count=’yes’]