What libraries can I use to build a GUI with Erlang?

23,712

Solution 1

Most people don't code the actual GUI in Erlang. A more common approach would be to write the GUI layer in Java or C# and then talk to your Erlang app via a socket or pipe.

With that in mind, you probably want to look into various libraries for doing RPC between java or .Net applications and Erlang:

http://weblogs.asp.net/nleghari/archive/2008/01/08/integrating-net-and-erlang-using-otp-net.aspx

http://www.theserverside.com/tt/articles/article.tss?l=IntegratingJavaandErlang

EDIT If you're truly set on coding an interface in erlang, you might consider doing a web-based GUI served via Yaws, the erlang web server: http://yaws.hyber.org/appmods.yaws

Solution 2

For GUI application in Erlang you should use wxErlang which is included in the r13b release. The beta has been around on source for some time but is now, since r13a, included in the main OTP release.

Solution 3

I'll violate the 'one option per post' request - sorry, but which tool to use really depends on what your priorities are.

One fairly stable library is gtkNode. It uses a simple but powerful way to map all GTK widgets to Erlang, and should continue to be stable across releases. It also works well with the Glade GUI builder. It's actively maintained by Erlang guru Mats Cronqvist, but it's of course best-effort.

WxWidgets is very promising and will hopefully become the main GUI library for Erlang, but it's still in beta, and the interface is not yet stable and no promises of backward compatibility are made yet.

So if you want to be a bit on the bleeding edge, WxWidgets may be your thing. Otherwise, gtkNode should give you a good-looking GUI with relative ease and safety.

The only officially supported GUI library for Erlang is GS, part of the OTP release and guaranteed to work with upcoming releases. So if this is more important than native look and feel and a modern looking facade, it may be an option.

Solution 4

I find it a little puzzling that anyone would want to write a GUI for a Erlang program in something other than Erlang? Erlang's concurrency model makes it an excellent language to write GUIs in. UI elements and events map perfectly onto Erlang processes and messages.

Solution 5

For writing native GUIs for Erlang, wxErlang seems to be the most mature library today (also on SourceForge).

Share:
23,712

Related videos on Youtube

givanse
Author by

givanse

The MVC family tree: https://mvc.givan.se/

Updated on June 06, 2020

Comments

  • givanse
    givanse almost 4 years

    What libraries can I use to build a GUI for an Erlang application? Please one option per answer.

    • Jason Bunting
      Jason Bunting over 15 years
      Will be interesting to see what responses come in - erlang isn't exactly one of the most popular languages, unfortunately.
  • bmdhacks
    bmdhacks over 15 years
    It's not that erlang wouldn't be well suited to a GUI, it's that because it's so good at network applications and message passing that it leads people away from hard-coding the UI interface directly into the erlang system.
  • bmdhacks
    bmdhacks over 15 years
    Instead, people generally write very thin clients that just relay button presses or other UI interactions back to the erlang app. This way, you don't have to depend on users actually having the erlang runtime on their system.
  • bmdhacks
    bmdhacks over 15 years
    Again, because erlang is mostly used for distributed server-side applications, there hasn't been much interest in giving it a GUI, even if it's well suited to the task.
  • bmdhacks
    bmdhacks almost 13 years
    Erlang isn't the sort of language I would recommend for something small. It really starts to shine when you need it to scale like crazy, or when you need a platform that never goes down, even when you upgrade the code. These tend to be big projects already.
  • Adam Lindberg
    Adam Lindberg almost 13 years
    It's just that the first thing to recommend for a GUI library for Erlang would never be to link to Java/C# for me. :-) For a huge project though, it's a valid option.
  • allyourcode
    allyourcode about 9 years
    This tutorial requires an account. WAT. Also, the first piece of code is generated C++ with no commentary about the equivalent Erlang code. WAT. What if I'm not familiar with the C++ API? What if I'm not familiar with C++?
  • Doug Edmunds
    Doug Edmunds about 9 years
    Not sure where you are looking. There's no C++ in the tutorial, Just Erlang using wxErlang.