Very simple, terse and easy GUI programming “frameworks” [closed]

房东的猫 提交于 2019-11-29 18:48:29
rampion

Not to kid, but HTML.

It's cross-platform, and sums up the gui-layout in a simple textfile. It's definitely mature, as well as well-understood and well documented.

There's a bunch of ways to template HTML files for dynamic content, and other ways to convert custom syntaxes to HTML if you dislike angle-brackets.

Client-side scripting w/ Javascript, server-side scripting with PHP/Ruby/Python/Perl.

It's not well suited for all purposes, but for many, it's good enough. There's no reason that it has to be served either - you can distribute a HTML file to your clients if you want - see TiddlyWiki for a good example of where that can go.

What you're describing is, with the exception of shoes, the new-fangled notion of declarative programming. I'd describe shoes more as a GUI Domain-Specifc Language. Well, I say new-fangled: Visual Basic forms, if you looked behind the IDE designer, were declarative. So, going further back still, were Oracle's SQL*Forms, although assembling them with a text editor was a process only to be be undertaken by the very bravest.

To add another to the list, Microsoft have XAML which, among other things, describes GUIs built for the WPF.

Although some of the schemes mentioned are fairly simple, declaratively-defined GUIs can be as complex as anything defined in code, they're just easier and terser: they say "what" you want to happen and leave it to the underlying framework to handle the "how".

TCL/TK is a script language used for building GUI interactively. It is available on various platforms including Unix, Windows and Mac OS X.

Pyjamas - http://pyjs.org - it's a desktop widget set, disguised as an AJAX-based web 2.0 widget set. it's so very much NOT like a web widget set that i actually ported it to the desktop - http://pyjd.org - using webkit (the same engine in adobe AIR, google chrome, safari etc.)

this is "hello world":

from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Button import Button
from pyjamas import Window

def greet(fred):
    Window.alert("Hello, AJAX!")

if __name__ == '__main__':
    b = Button("Click me", greet)
    RootPanel().add(b)

that immediately answers the first four out of five requirements. requirement 5 is fulfilled by this:

from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HorizontalPanel import HorizontalPanel
from pyjamas.ui.HTML import HTML

p = HorizontalPanel()
p.add(HTML("<b>Hello</b>"))
p.add(HTML("World"))
RootPanel().add(p)

it couldn't get any simpler.

XUL (it's pretty easy to use, and powerful -- much of Firefox is implemented using XUL for GUI structure, + javascript for logic handling)

The XUL tutorial has some good examples. Here's one for tabboxes. The one at the bottom of the page has switchable tabs, buttons, edit boxes, and group boxes, and it's fairly simple (no Javascript/CSS/XBL/key bindings/etc). They then add progressively more stuff later which is a lot of functionality for the length of the file that specifies it. (at least until you start adding javascript to handle the logic in question) If I had to do something like this in Win32 it would be a real pain.

Nick

wxLua is a wrapper of the wxWidgets library for Lua. It uses a Connect method to attach gui widget events to functions (functions are first class like in JS).

GTK-server is extremely simple to use and can be used from more than 30 languages, including Bash and Visual Basic.

SDL/Swing is extremely terse, readable, unobtrusive (283k lib with no dependencies) and easy to use. Example:

menus {
    "File" {
        "Open" do="open" // calls "open()" in the controller
        "---"
        "Exit" do="exit"
    }
}

Its open source but enjoys commercial support from Ikayzo.com. Ports for .NET and iOS are underway.

I juat came across SDL/Swing today.

You should have a look at XAML if you're on the .NET platform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!