非常简单,简洁和容易的GUI编程“框架" [英] Very simple, terse and easy GUI programming “frameworks”

查看:98
本文介绍了非常简单,简洁和容易的GUI编程“框架"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请列出允许快速编写GUI应用程序的GUI编程库,工具包和框架.我的意思是这样,

Please list GUI programming libraries, toolkits, frameworks which allow to write GUI apps quickly. I mean in such a way, that

  • GUI完全以人类可读(和人类可写)的纯文本文件(代码)进行描述
  • 代码简洁(每个小部件/事件对1或2行代码),适合编写脚本
  • 从代码(小部件的嵌套和事件流)可以明显看出GUI的结构和操作
  • 有关如何构建GUI的细节被隐藏(诸如mainloop,附加事件监听器之类的东西)
  • 支持自动布局(vbox,hbox等)
  • GUI is described entirely in a human-readable (and human-writable) plain text file (code)
  • code is terse (1 or 2 lines of code per widget/event pair), suitable for scripting
  • structure and operation of the GUI is evident from the code (nesting of widgets and flow of events)
  • details about how to build the GUI are hidden (things like mainloop, attaching event listeners, etc.)
  • auto-layouts are supported (vboxes, hboxes, etc.)

正如答案所暗示的那样,这可以定义为 declarative GUI编程,但不一定是这样.只要可行,任何方法都可以,并且易于使用和简洁.

As answers suggest, this may be defined as declarative GUI programming, but it is not necessarily such. Any approach is OK if it works, is easy to use and terse.

有一些类似的GUI库/工具包.它们在下面列出.如果您发现缺少合格工具包,请扩展列表.指出该项目是否是跨平台的,成熟的,活跃的,并在可能的情况下给出示例.

There are some GUI libraries/toolkits like this. They are listed below. Please extend the list if you see a qualifying toolkit missing. Indicate if the project is crossplatform, mature, active, and give an example if possible.

请使用此Wiki讨论仅开放源代码项目.

Please use this wiki to discuss only Open Source projects.

这是到目前为止的列表(按字母顺序):

This is the list so far (in alphabetical order):

预算是Haskell库.平台:Unix.状态:实验性,但仍保持不变.一个例子:

Fudgets is a Haskell library. Platform: Unix. Status: Experimental, but still maintained. An example:

  import Fudgets
  main = fudlogue (shellF "Hello" (labelF "Hello, world!" >+< quitButtonF))


(来源: picamatic.com )


(source: picamatic.com)

文艺复兴允许以简单XML描述GUI.平台:OSX/GNUstep.状态:GNUstep的一部分.下面的示例:

Renaissance allows to describe GUI in simple XML. Platforms: OSX/GNUstep. Status: part of GNUstep. An 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> 


(来源: picamatic.com )


(source: picamatic.com)

基于HTML的GUI(HTML + JS).跨平台,成熟.可以完全在客户端使用.

HTML-based GUI (HTML + JS). Crossplatform, mature. Can be used entirely on the client side.

寻找一个不错的"helloworld"示例.

Looking for a nice "helloworld" example.


(来源: picamatic.com )


(source: picamatic.com)

JavaFX 可用于独立(桌面)应用以及网络应用程序.尚未完全跨平台,尚未完全开源.状态:1.0版本.一个例子:

JavaFX is usable for standalone (desktop) apps as well as for web applications. Not completely crossplatform, not yet completely open source. Status: 1.0 release. An example:

  Frame {
    content: Button {
      text: "Press Me"
      action: operation() {
         System.out.println("You pressed me");
      }
    }
    visible: true
  }

需要截图.

Phooey 是另一个Haskell库.跨平台(wxWidgets),已计划HTML + JS后端.成熟活跃.一个例子(比helloworld多一点):

Phooey is another Haskell library. Crossplatform (wxWidgets), HTML+JS backend planned. Mature and active. An example (a little more than a 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 (+) a b)


(来源: picamatic.com )


(source: picamatic.com)

PythonCard 在Python字典中描述了GUI.跨平台(wxWidgets).一些应用程序使用它,但是该项目似乎停滞了.有一个活跃的叉子.

PythonCard describes GUI in a Python dictionary. Crossplatform (wxWidgets). Some apps use it, but the project seems stalled. There is an active fork.

我跳过了 PythonCard示例,因为它太冗长了比赛.

I skip PythonCard example because it is too verbose for the contest.


(来源: picamatic.com )


(source: picamatic.com)

Ruby的鞋子.平台:Win/OSX/GTK +.状态:年轻但活跃.一个最小的应用程序看起来像这样:

Shoes for Ruby. Platforms: Win/OSX/GTK+. Status: Young but active. A minimal app looks like this:

  Shoes.app {
     @push = button "Push me"
     @note = para "Nothing pushed so far"
     @push.click {
        @note.replace "Aha! Click!"
     }
  }


(来源: picamatic.com )


(source: picamatic.com)

Tcl/Tk .跨平台(自己的窗口小部件集).成熟(可能甚至过时)和活跃.一个例子:

Tcl/Tk. Crossplatform (its own widget set). Mature (probably even dated) and active. An example:

  #!/usr/bin/env wish
  button .hello -text "Hello, World!" -command { exit }
  pack .hello
  tkwait window .


(来源: picamatic.com )


(source: picamatic.com)

tekUI 用于Lua(和C).平台:X11,DirectFB.状态:Alpha(可用,但API仍在发展).一个例子:

tekUI for Lua (and C). Platforms: X11, DirectFB. Status: Alpha (usable, but API still evolves). An 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()


(来源: picamatic.com )


(source: picamatic.com)

Treethon (适用于Python).它在YAML文件(YAML树中的 Python )中描述了GUI.平台:GTK +.现状:处于压力状态.一个简单的应用程序如下所示:

Treethon for Python. It describes GUI in a YAML file (Python in a YAML tree). Platform: GTK+. Status: work in proress. A simple app looks like this:

  _import: gtk
  view: gtk.Window()
  add:
      - view: gtk.Button('Hello World')
        on clicked: print view.get_label()

Treethon helloworld屏幕快照http://treethon.googlecode.com/svn/trunk/treethon_gtk_tutorial/base.png

此版本尚未发布.这个想法是使用Python上下文管理器(with关键字)来构造GUI代码.有关详细信息,请参见 Richard Jones的博客.

This one is not released yet. The idea is to use Python context managers (with keyword) to structure GUI code. See Richard Jones' blog for 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还可用于通过XULRunner创建独立的桌面应用程序作为Mozilla扩展.成熟,开源,跨平台.

XUL

XUL + Javascript may be used to create stand-alone desktop apps with XULRunner as well as Mozilla extensions. Mature, open source, crossplatform.

  <?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>


(来源: picamatic.com )


(source: picamatic.com)

感谢您的贡献!

推荐答案

不是孩子,而是HTML.

Not to kid, but HTML.

它是跨平台的,将gui布局汇总在一个简单的文本文件中.它肯定是成熟的,并且易于理解和有据可查.

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.

有很多方法可以为动态内容的HTML文件创建模板,如果不喜欢尖括号,可以使用其他方法将自定义语法转换为HTML.

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.

带有Javascript的客户端脚本,使用PHP/Ruby/Python/Perl的服务器端脚本.

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

它不能很好地满足所有目的,但是对于许多目的来说,已经足够了.也没有理由必须提供它-您可以根据需要将HTML文件分发给客户-请参见 TiddlyWiki 是可以实现此目标的一个很好的例子.

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.

这篇关于非常简单,简洁和容易的GUI编程“框架"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆