The Graphical User Interface group recommendations There will be many uses of GUI of various kinds in D0 for run II. Audience -------- 1. Physicist end users 2. developers and utility maintainers. Mostly physicists. Examples -------- 1. Global Information access and management a. User would like information on data processing for particular event. Web page provides user complete information about the chain of processing, versions etc. for a particular event b. User would like information ablut status of online systems. Web page gives complete access to control room information with graphics and tables showing status of any part of the online system. c. User wants to submit a query for a particular set of data object attribute requirements (cuts), and is returned i. estimated time for the query. ii. number of tape mount accesses required iii. ask to proceed? iv. If the query proceeds, eventually user is provided with information for events selected. This can be in the form of a list of event or object pointers, or complete event data. d. Data manager has access to data usage patterns and can control configuration management of the data. e. Code management menu system to allow for easy monitoring and manipulation of software. 2. Local application menu-based interface. a. User runs local event reconstruction or analysis package and would like a convenient way to setup configuration. Needs flexible interface and capability to submit jobs in batch mode as well. The interface should be menu driven, intuitive based on experience of other similar menus, and easily extensible. Related to frames. 3. Interactive graphics interface a. Way to control and examine details of event display for viewing and analysis tasks. Our criteria for the tools which we use are somewhat dependent on the application, but in general we will need 1. ease of use, 2. ease of programming, 3. UNIX and windows platform independence, 4. long-term (10 to 15 years) lifetime. Possible solutions There are several closely related domain areas involved in the field of GUIs. 1. "scripting" language, 2. widgets or windowing toolkit, 3. high level graphics interface. Languages considered 1. TCL 2. PYTHON 3. PERL 4. JAVA 5. Visual BASIC Widget or windowing toolkit 1. TK 2. AWT 3. wxwindow 4. Other sources of widgets such as Free Widget Foundation (FWF) High level graphics interface 1. OpenGL 2. Open Explorer 2. Open Inventor Additional considerations are how complete are library extentions? How rich is the development environment, like debuggers and class brousers. How much will it cost? Would it be easily extensible or scale up to larger applications. How will it interface to the many applications which we may be using at D0? TKL http://ourworld.compuserve.com/homepages/efjohnson/tcl.htm A Brief Introduction Tcl, pronounced tickle, stands for the Tool Command Language. With its associated user interface toolkit, Tk, pronounced tee-kay, you can quickly create cross-platform applications. The latest news in the Tcl/Tk community is the final release of Tcl 7.5 and Tk 4.1. These are the first releases to officially support Windows and Macintosh platforms, in addition to Unix. Created by John Ousterhout, now working at Sun Microsystems, Tcl is more like a scripting language than a programming language, so it shares a greater similarity to the C shell or perl than it does to C++ or C. For example, the following is the Hello World program in Tcl/Tk: button .b -text "Hello World" -command exit pack .b Tcl has a simple structure. Each line starts out with a command, such as button and a number of arguments. Each command is implemented as a C function. This function is responsible for handling all the arguments. Tcl commands can span multiple lines through the use of a line continuation marker, \, or curly braces, { and }. You can create your own commands in C or you can use the Tcl proc command to create procedures written in Tcl. Some key features of Tcl include: Tcl is a high-level scripting language. You'll find you need to write a lot less code to get your job done, especially when compared to Motif or Win32 applications. Tcl is interpreted. You can execute your code directly, without compiling and linking (though Tcl compilers are available). Tcl is extensible. It's very easy to add your own commands to extend the Tcl language. You can write your commands in C or Tcl. Tcl is embeddable. The Tcl interpreter is merely a set of C functions that you can call from your code. This means you can use Tcl as an application language, much like a macro language for a spreadsheet application. Tcl runs on many platforms. Versions exist for Unix, Windows and Macintosh platforms. Except for a few platform differences, your Tcl scripts run the same on all systems. Tcl's auto-loading facility makes for smaller applications. Tcl will automatically load in your libraries of Tcl procedures (with one line of code to set up the path to your library). Tcl will also, on systems that support it, automatically load dynamic (shared, DLL) libraries when needed. This is very handy. Tcl is free. Yep. You can get the sources for free over the Internet from Sun's FTP site for Tcl. This site includes the source code version, as well as binary versions for Windows and Macintosh platforms. Or, you can get Tcl on a number of CD-ROMs for a nominal cost. When Should You Use Tcl? For more information on when to use Tcl and when to use other languages, such as perl, see the Comparisons of Tcl with other systems page, which contains quite a lot of comparisons of Tcl with languages like perl and Java. Running Tcl Programs Since Tcl is an interpreted language, to run a Tcl program (also called a script), you normally pass the script file to the Tcl interpreter, wish, for example: wish hello.tcl You can also use wish in interactive mode and type in commands at the command line. There's another standard Tcl interpreter, tclsh, which only understands the Tcl language. tclsh does not have any of the Tk user interface commands, so you cannot create graphical programs in tclsh. Some Tcl freeware applications extend the Tcl language by adding new commands written as C functions. If such is the case, you need to compile the application instead of just passing its Tcl code to the wish interpreter. This application program, from a Tcl perspective, is really a new version of the wish interpreter, which the new C commands linked in. Of course, the application program may be a lot more than merely a Tcl interpreter. (Note: you can also use Tcl's auto-loading capability on systems that support it.) Extensions Since Tcl is so easy to extend, many try to share extensions, including the popular itcl, [incr Tcl], ObjectTcl, TclX, Tix and BLT. Before using any of these extensions, be sure to check the license agreement. Tix, for example, is becoming a commercial product and will be free only for non-commercial use. These extensions, of course, require an extended Tcl interpreter. In addition, many Tcl freeware applications require a particular Tcl extension to run. One very popular extension is called Expect, which allows you to place a friendly front-end onto most command-line based Unix applications, such as telnet, ftp, passwd, fsck, rlogin, tip and so on. Python from http://www.python.org/ Python is a portable, interpreted, object-oriented programming language developed over the past five years at CWI in Amsterdam. The language has an elegant (but not over-simplified) syntax; a small number of powerful high-level data types are built in. Python can be extended in a systematic fashion by adding new modules implemented in a compiled language such as C or C++. Such extension modules can define new functions and variables as well as new object types. Here's a simple function written in Python, which inverts an table (represented as a Python's dictionary): def invert(table): index = {} # empty dictionary for key in table.keys(): value = table[key] if not index.has_key(value): index[value] = [] # empty list index[value].append(key) return index Note how Python uses indentation for statement grouping. Comments are introduced by a `#' character. Here's an example of interactive use of this function (">>> " is the interpreter's prompt): >>> phonebook = {'guido': 4127, 'sjoerd': 4127, 'jack': 4098} >>> phonebook['dcab'] = 4147 # add an entry >>> inverted_phonebook = invert(phonebook) >>> print inverted_phonebook {4098: ['jack'], 4127: ['guido', 'sjoerd'], 4147: ['dcab']} >>> Python has a full set of string operations (including regular expression matching), and frees the user from most hassles of memory management. These and other features make it an ideal language for prototype development and other ad-hoc programming tasks. Python also has some features that make it possible to write large programs, even though it lacks most forms of compile-time checking: a program can be constructed out of a number of modules, each of which defines its own name space, and modules can define classes which provide further encapsulation. Exception handling makes it possible to catch errors where required without cluttering all code with error checking. A large number of extension modules have been developed for Python. Some are part of the standard library of tools, usable in any Python program (e.g. the math library and regular expressions). Others are specific to a particular platform or environment (e.g. UNIX, IP networking or X11) or provide application-specific functionality (e.g. image or sound processing). Python also provides facilities for introspection, so that e.g. a debugger or profiler for Python programs can be written in Python itself. There is also a generic way to convert an object into a stream of bytes and back, which can be used to implement object persistency as well as various distributed object models. Java from http://sunsite.unc.edu/javafaq/javatutorial.html#xtocid5001 Java has caused more excitement than any development on the Internet since Mosaic. Everyone, it seems, is talking about it. Unfortunately very few people seem to know anything about it. This tutorial is designed to change that. People are excited about Java because of what it lets them do. Java was the first way to include inline sound and animation in a web page. Java also lets users interact with a web page. Instead of just reading it and perhaps filling out a form, users can now play games, calculate spreadsheets, chat in realtime, get continuously updated data and much, much more. Here are just a few of the many things Java can do for a web page: Inline sounds that play in realtime whenever a user loads a page Music that plays in the background on a page Cartoon style animations Realtime video Multiplayer interactive games However Java is more than just a web browser with special features. All of these features can be integrated into browsers in other ways. Although HotJava was the first browser to include inline sound and animation, Microsoft's Internet Explorer 2.0 and Netscape Navigator 2.0 support these features in several different ways. What makes Java special? Java is a programming language for distributed applications. It doesn't just allow you to add new types of content to your pages like Netscape and Internet Explorer do. Rather it lets you add both the content and the code necessary to interact with that content. You no longer need to wait for the next release of a browser that supports your preferred image format or special game protocol. With Java you send browsers both the content and the program necessary to view this content at the same time! Let's think about what this means for a minute. Previously you had to wait for all the companies that make the web browsers your readers use to update their browsers before you could use a new content type. Then you had to hope that all your readers actually did update their browsers. Java compatibility is a feature that any browser can implement and by so doing implement every feature! For instance let's say you want to use EPS files on your Web site. Previously you had to wait until at least one web browser implemented EPS support. Now you don't wait. Instead you can write your own code to view EPS files and send it to any client that requests your page at the same time they request the EPS file. Or suppose you want people to be able to search your electronic card catalog. However the card catalog database exists on a mainframe system that doesn't speak HTTP. Before Java you could hope that some browser implemented your proprietary card catalog protocol; (fat chance) or you could try to program some intermediate cgi-bin on a UNIX box that can speak HTTP and talk to the card catalog, not an easy task. With Java when a client wants to talk to your card catalog you can send them the code they need to do so. You don't have to try to force things through an httpd server on port 80 that were never meant to go through it. If that were all Java was, it would still be more interesting than a or tag in some new browser beta. But there's a lot more. Java is platform independent. A Java program can run equally well on any architecture that has a Java enabled browser. With the release of Netscape Navigator 2.0 that includes Windows 95, Windows NT, the MacOS, Sun Solaris, Sun OS 4.1.3, SGI IRIX, OSF/1, HP-UX with more to come. But wait. There's more! Java isn't just for web sites. Java is a programming language that lets you do almost anything you can do with a traditional programming langauge like Fortran or C++. However Java has learned from the mistakes of its predecessors. It is considerably cleaner and easier to use than those languages. As a language Java is Simple Java has the bare bones functionality needed to implement its rich feature set. It does not add lots of syntactic sugar or unnecessary features. Object-Oriented Almost everything in Java is either a class, a method or an object. Only the most basic primitive operations and data types (int, for, while, etc.) are at a sub-object level. Platform Independent Java programs are compiled to a byte code format that can be read and run by interpreters on many platforms including Windows 95, Windows NT, and Solaris 2.3 and later. Safe Java code can be executed in an environment that prohibits it from introducing viruses, deleting or modifying files, or otherwise performing data destroying and computer crashing operations. High Performance One day (but not today) Java will be compilable on the fly to code that rivals C++ in speed. Multi-Threaded Java is inherently multi-threaded. A single Java program can have many different things processing independently and continuously. Other Notable options Perl has a web and TK interface built inot the 5.0 release. Visual BASIC Although simple to learn and visually appealing, Visual Basic works only on MicroSoft platforms. It was included inthe list as an example of what might be a possible way to easily put together GUIs. It's slick, people who use it like it, but it is no good for us. Graphics widgets for menus, etc. The toolkit (tk) provided by John Osterhut There are extensive lists of the kinds of widgets available, following are some examples and more detailed descriptions and some pictures included in the appendix. Labels, buttons checkbuttons, radio buttons, Iconic buttons, image viewer, list boxes, entries with and without scrollbars, canvases, linear scales, thumbwheels, pulldown menus possibly with cascades. Some specific examples for comparison Menu annimation sound Recommendations based on current experience General overall considerations Costs Manpower Goals and future directions