Updated 2017-04-06 09:58:12 by EMJ

A Graphical User Interface is a user interface that utilizes video graphics capabilities of a computer. Many toolkits for the creation of GUI's exist. In the Tcl world, Tk is one of the most commonly used, but there are Tcl bindings for other toolkits as well; see for instance Alternative GUI Toolkits.

See Also  edit

GUI Building Tools
GUI Toolkit
The GUI Toolkit, Framework Page (alternates: [1] [2])
a list of GUI toolkits from 2007 and before

Tcl/Tk for larger GUI projects  edit

RKzn 2017-04-05 There have been an interesting discussion on comp.lang.tcl about the suitability of Tcl/Tk for larger GUI projects. I think there is a post by Brian Griffin which is a very nice summary on GUIs in Tcl/Tk and in general, so I'll quote it here:

«I have extensive experience developing a commercial GUI using Tcl/Tk. I agree with a lot that has already been said, that good code requires skilled programmers, this point is independent of programming language. Furthermore, good GUI's require skills that go beyond just good programming.

I think some of the sloppiness seen in Tcl/Tk programs comes from the interactive nature of the language. I often start by hacking bits in an interactive session. The short term goal is to see something working first. This leads to haphazard code for sure, but it's a win because the time from notion to working GUI is very short. Compare that to C++ where you got nothing until you have a complete consistent set of classes cobbled together into a compilable and linkable program, and even then you're just beginning to see only a glimpse of a working UI. This speed in reaching the point of testing a concept is what makes Tk so powerful!

To get to and maintain a large code base for a complex GUI requires [coding discipline] and a design process that includes testing as a goal. Introspection is a foundational element of Tcl/Tk. It should be part of all application code as well. It is a useful and powerful tool for testing.

Understanding Model-View-Controller (MVC), or any of the other similar design patterns, is a must. Failing to understand and implement this pattern is where GUI's often go wrong. Tk does implement MVC with limitations. Understanding those limitations is important as well.

Understanding event based programming and the event loop is critically important.

Separating the GUI from the "work" of an application is another important aspect of a good GUI. Web based applications have this forced upon them; browsers are the GUI, and servers do the "work". For desktop GUIs, this separation has to be designed into the application.

One of the biggest challenges for large Tcl programs, in my experience, is in understanding "type" and having the discipline to program in a type clean manner. What do I mean by "type"? I mean writing code that is consistent when dealing with a list, a string, a [number], a dict, etc., and knowing when the code is intentionally transitioning from one to another. I think it's fair to say that most bugs are the result problems in not paying attention to the "type". It is also the reason why typed languages have much more respect in CS academia, because the compilers can tell you when you get it wrong.

To summarize:

  • Design for test
  • Separate GUI from work
  • Test
  • Use MVC or similar design pattern
  • Test
  • Know your type
  • Test

These things are true for any GUI technology, not just Tk. If a GUI comes up short, it will not be Tk or any other GUI tech, but one of the items above that is at fault.»

End quote. Note that the links are mine (or of those who added more later) and that it may be worth reading the whole discussion.