Puppy is a tiny distribution, but there is a wide choice of
programming languages. The default live-CD is not setup for compiling C
or C++
programs, however there is an add-on file named 'devx_xxx.sfs' (where
'xxx' is the Puppy version number, for example '210') that turns
Puppy into a complete C/C++ compiling environment (FreeBASIC compiler also). Without
devx_xxx.sfs, the live-CD already has many languages, including
Ash/Bash scripting, Tcl/Tk and PuppyBasic. This page has a summary of
the programming options in Puppy...
A language that is all ready for action in Puppy is command-shell
scripting. Unix and Linux shell command-scripting has been around for
ages and is going to be around for a long time to come. What I mean by the
"command shell" is the user interface that you use when at the commandline.
When you are running X, the commandline will be in a terminal window, but
you can also exit from X and be back at a commandline.
e2, mp, Geany, Leafpad |
Text editors |
Ash |
Command shell used in Puppy |
BusyBox |
A suite of basic Unix/Linux console applications, can
be used in scripts |
Xdialog |
A GTK GUI frontend for scripts |
xmessage |
A very basic X11 GUI dialog frontend for scripts |
xcut |
A console application for cut-to and paste-from the
clipboard |
gtk-shell |
This is a very flexible, simple, tiny GTK alternative
to xmessage and Xdialog. Can display/edit files, display a
file-selection dialog, prompt for user input, choice buttons. No
documentation. Just type "# gtk-shell -h" for help. |
gtkdialog3 |
This is yet another alternative to gtk-shell, xmessage
and Xdialog. gtkdialog is a GTK2 application and reads an XML file
that describes the dialog format and user interaction, allowing
incredible sophisticated GUIs. This program was introduced with Puppy
0.9.7. I think that gtkdialog is the pick of the bunch! Note that Puppy currently has two versions of gtkdialog, named gtkdialog2 and gtkdialog3 -- it is preferred that you use the latter as this will eventually be the only one in Puppy -- in other words, always execute the binary "gtkdialog3". |
Tcl is an interpreted scripting language, similar in concept to Ash scripts as described above, and indeed a Tcl program can just as easily be made into a shell script. However, what really sets Tcl apart is the Tk library, which makes it into a full-blown GUI programming environment. There are many extension libraries for Tcl, and Puppy currently has Tk (the standard extension, provides all the basic widgets), Img (Tcl/Tk only handles gif files, this extends to jpeg, png, etc.), Combobox (a sophisticated widget), BWidget (more sophisticated widgets). Note that you can find all of these in /usr/lib.
Many applications in Puppy (or as PET packages) are written in Tcl/Tk, such as Slidedraw, TkZip, CDTAR, XS, snamp, tkpppoe, phv, TkDVD and regexpviewer.
Why Tcl? Why not Perl or Java? For me personally, there are three main reasons: there are a huge number of GUI applications available, Tcl/Tk is fairly small, and it is a very simple easy-to-learn language. That last point is extremely important, as I can actually read code that other people have written, unlike all the languages based on the C syntax, that can have quite obscure code (C++, Java).
Another point to consider is support. The Tcl/Tk community is very active, and their websites have heaps and heaps of docs, tutorials and code examples. Also, Tcl/Tk is pervasive -- every Unix and Linux distro has it. Also it is available for the other operating systems, such as Windows and Mac.
Here are some tools in Puppy to aid Tcl/Tk programming:
ML | The console editor MP and the GUI editor Beaver have color syntax highlighting for Tcl/Tk, however Puppy has yet another text editor, called ML, that is especially designed for Tcl/Tk coding. ML has color syntax highlighting and a rapid jump-to-procedure feature. |
tkcon | This is a console, like rxvt terminal emulator, and in fact capable of doing much the same as rxvt, but with special features to aid Tcl/Tk programming -- CURRENTLY NOT IN PUPPY |
I have not placed documentation to teach Tcl/Tk into Puppy: for that, obtain a good book, or study online docs on the Internet. To find out more about Tcl/Tk, here are some links:
www.tcl.tk/advocacy/top10.html | Top 10 reasons to choose Tcl |
www.tldp.org/HOWTO/Scripting-GUI-TclTk | Scripting graphical commands with Tcl/Tk: mini HOWTO |
mini.net/tcl/540.html | Is Tcl different! |
mini.net/tcl/3222 | Tcl/Tk is too easy |
rsusu1.rnd.runnet.ru/graphics/tcl/tcl-faq | comp.lang.tcl newsgroup FAQ |
wiki.tcl.tk/969 | Arts and crafts of Tcl-Tk programming |
hegel.ittc.ukans.edu/topics/tcltk/ | Online docs |
www.beedub.com/book/ | Book extracts "Practical programming in Tcl and Tk" |
This is an interpreter, and another alternative for developing scripts in Puppy.
PuppyBasic is also known as wxBasicScript, and is derived from a more powerful version called wxBasic.
PuppyBasic has extensions for X programming, in particular to use Xdialog and gtkdialog for creating windows.
Documentation is on the Internet:
(c) Copyright 2004,2005,2006,2007 Barry Kauler