Please list the GUI programming libraries, toolkits, frameworks that allow you to quickly write graphical applications. I mean in a way that
- The GUI is described completely in a text file (code) that is readable by humans (and for humans)
- the code is short (1 or 2 lines of code per widget / event pair), suitable for scripts
- The structure and operation of the graphical interface is obvious from the code (embedding widgets and the flow of events)
- information on how to create a graphical interface is hidden (for example, mainloop, adding event listeners, etc.).
- supported automatic layouts (vbox, hbox, etc.).
As the answers show, this can be defined as declarative GUI programming, but this is not necessarily the case. Any approach is fine, if it works, easy to use and concise.
There are some GUI libraries / tools like this. They are listed below. Please distribute this list if qualified tools are not available. Indicate if the project is cross-platform, mature, active and give an example, if possible.
Please use this wiki to discuss only open source projects.
This is the list so far (in alphabetical order):
Fudgets
Fudgets is the Haskell library. Platform: Unix. Status: experimental, but still supported. Example:
import Fudgets main = fudlogue (shellF "Hello" (labelF "Hello, world!" >+< quitButtonF))
Example screenshots of Fudgets http://www.picamatic.com/show/2009/01/28/02/40/1883597_93x80.gif
GNUstep Renaissance
Renaissance allows you to describe a GUI in plain XML. Platforms: OSX / GNUstep. Status: part of GNUstep. Example below:
<window title="Example"> <vbox> <label font="big"> Click the button below to quit the application </label> <button title="Quit" action="terminate:"/> </vbox> </window>
Renaissance screenshot example http://www.picamatic.com/show/2009/01/28/03/19/1884098_289x80.png
HTML
HTML-oriented graphical interface (HTML + JS). Cross-platform, mature. It can be used completely on the client side.
We are looking for a good example of "helloworld".
HTML GUI Example http://www.picamatic.com/show/2009/01/28/02/44/1883635_264x60.png
Javafx
JavaFX can be used for standalone (desktop) applications, as well as for web applications. Not fully cross-platform, not yet fully open source. Status: Release 1.0. Example:
Frame { content: Button { text: "Press Me" action: operation() { System.out.println("You pressed me"); } } visible: true }
A screenshot is required.
Phooey
Phooey is another Haskell library. Crossplatform (wxWidgets), HTML + JS plan planned. Mature and active. Example (slightly larger than helloworld):
ui1 :: UI () ui1 = title "Shopping List" $ do a <- title "apples" $ islider (0,10) 3 b <- title "bananas" $ islider (0,10) 7 title "total" $ showDisplay (liftA2 (+) ab)
Phooey screenshot example http://www.picamatic.com/show/2009/01/28/02/33/1883543_236x187.png
Pythoncard
PythonCard describes a graphical interface in the Python dictionary. Cross-platform (wxWidgets). Some applications use it, but the project seems to be inhibited. There is an active plug.
I skipped the PythonCard example because it is too detailed for the contest.
PythonCard screenshot example http://www.picamatic.com/show/2009/01/28/02/46/1883646_199x99.gif
Footwear
Shoes for Ruby. Platforms: Win / OSX / GTK +. Status: Young but active. The minimum application is as follows:
Shoes.app { @push = button "Push me" @note = para "Nothing pushed so far" @push.click { @note.replace "Aha! Click!" } }
Example screenshots for shoes http://www.picamatic.com/show/2009/01/28/03/14/1884011_227x71.png
Tcl / tk
Tcl / Tk . Crossplatform (own widget set). Mature (possibly even dated) and active. Example:
#!/usr/bin/env wish button .hello -text "Hello, World!" -command { exit } pack .hello tkwait window .
Tcl / Tk screenshot example http://www.picamatic.com/show/2009/01/28/02/51/1883672_111x58.png
tekUI
tekUI for Lua (and C). Platforms: X11, DirectFB. Status: Alpha (in use, but the API is still evolving). Example:
#/usr/bin/env lua ui = require "tek.ui" ui.Application:new { Children = { ui.Window:new { Title = "Hello", Children = { ui.Text:new { Text = "_Hello, World!", Style = "button", Mode = "button", }, }, }, }, }:run()
tekUI helloworld screenshot http://www.picamatic.com/show/2009/01/28/03/01/1883821_290x55.png
Treethon
Treethon for Python. It describes the GUI in the YAML file (Python in the YAML tree). Platform: GTK +. Status: work in proress. A simple application is as follows:
_import: gtk view: gtk.Window() add: - view: gtk.Button('Hello World') on clicked: print view.get_label()
Screenshot of Treethon helloworld http://treethon.googlecode.com/svn/trunk/treethon_gtk_tutorial/base.png
Still unnamed Python library by Richard Jones:
This one has not been released yet. The idea is to use Python contextual managers ( with keyword) to structure your GUI code. See the Richard Jones blog for more details.
with gui.vertical: text = gui.label('hello!') items = gui.selection(['one', 'two', 'three']) with gui.button('click me!'): def on_click(): text.value = items.value text.foreground = red
Xul
XUL + Javascript can be used to create standalone desktop applications with XULRunner and Mozilla extensions. Mature, open source, cross-platform.
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="My App" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <caption label="Hello World"/> </window>
XUL example helloworld http://www.picamatic.com/show/2009/01/28/03/27/1884209_228x108.png
Thanks for the contribution!