| Author |
Message |
|
| bryan |
Posted: Mon Jul 16, 2007 11:28 am |
|
|
|
Joined: 15 Jul 2007
Posts: 8
|
I'm currently writing a program just to get used to Erlang, and I would like to add a GUI to my program. What is the best way to do this?
I found wxErlang, but the news on that page suggests it has not been updated for a year and a half. What other routes are there? Can I interface with something like Python somehow to create a GUI?
How is this normally done? |
|
|
| Back to top |
|
| Jonas |
Posted: Mon Jul 16, 2007 1:34 pm |
|
|
|
Joined: 22 Jun 2007
Posts: 1
Location: London
|
One way to do it is to create the GUI in Java (using Swing, SWT or even OpenGL) and then use
the Jinterface library to communicate with your Erlang process.
Jinterface lets you setup an Erlang node and a message-box. The Erlang process can then send-to and receive messages from this message-box just as like from any Erlang process.
The pros with this solution is that it's very clean, from the point of view of your Erlang application. On the other hand, it can be a bit clunky to construct Erlang messages on the Java side.
The Jinterface library is part of the standard Erlang distrubution (see http://www.erlang.org/doc/apps/jinterface/index.html)
What kind of application are you developing? Do you need active rendering (rendering in a loop)? |
|
|
| Back to top |
|
| Ulf |
Posted: Mon Jul 16, 2007 1:47 pm |
|
|
|
User
Joined: 04 Sep 2006
Posts: 42
Location: Göteborg
|
Seriously I would not develop GUIs in Erlang, at least not until some new library shows up.
Use as Jonas said, some other language to do the GUI and let Erlang do what it does best, and that is not GUIs.
There is libraries to use but I don't think any one of them is better then the wx one, especially in Windows there is a lot of problems and I wouldn't consider any of the libraries stable. |
|
|
| Back to top |
|
| michal |
Posted: Mon Jul 16, 2007 2:06 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 44
Location: London
|
All the applications that are included in the standard OTP tree and have GUIs use the GS. Start the graphical Erlang debugger or TV (used to examine ETS and Mnesia tables) from your Erlang shell to see the GS in action and to decide if that's what you need.
What is usually done in production systems is a web interface based on the INETS or YAWS web server. With XHTML/DHTML/JavaScript you can get better and more flexible results than with the GS based ones.
Michal |
_________________ http://www.erlang-consulting.com |
|
| Back to top |
|
| bryan |
Posted: Mon Jul 16, 2007 2:29 pm |
|
|
|
Joined: 15 Jul 2007
Posts: 8
|
Well actually, I'm trying to write a model train simulation. So the idea is, I have some pieces of tracks that are connected, and a train moves from track to track. Whenever it moves, it sends a message to a listener.
I haven't really thought it all through how drawing would go, but I imagine a first round would be that the tracks are drawn once, and then the train listener would send a message to whatever is responsible for drawing to redraw the train at a new position. (Keeping in mind that the 'tracks' will probably just be squares and the 'train' will probably be just a circle, but it would be better than the current:
Train <0,53,0> at <0,39,0>
Train <0,53,0> at <0,41,0>
Train <0,53,0> at <0,43,0>
Train <0,53,0> at <0,45,0>
Train <0,53,0> at <0,39,0>
Train <0,53,0> at <0,41,0>
Train <0,5...
I've done a little work with XHTML/JavaScript and I'm not sure I want to mess with that for just a toy project right now (I want to continue to focus on the Erlang side as much as possible, and just get something rudimentary going with the visual side).
I'll take a look into Jinterface. In the meantime, if the more in depth explanation gives you a better idea and you have more advice for me, I would certainly appreciate it.
Thanks for the help! |
|
|
| Back to top |
|
| francesco |
Posted: Mon Jul 16, 2007 2:51 pm |
|
|
|
User
Joined: 07 Jul 2006
Posts: 249
Location: London
|
If what you are doing is a quick hack to learn Erlang and you do not want to put any efforts into learning a new graphics package, gs is probably the way to go.
It was designed for prototypes with simplicity in mind, allowing people to put together GUIs integrated with their erlang programs in no time. When released in 1995, there were lots of internal debates within Ericsson whether more features should be added. That would have been easy, as TCL/TK has an extensive subset (At least at the time, it was the best open source alternative).
If what you are planing, however, is a system you need to present to a client or a final product you plan to sell, then do not use GS. There are better tools out there.
Francesco
PS. Erlang is being used by a French company in the railway industry.. And what you are doing was indeed an exercise in one of the courses using Erlang at Uppsala University 4 - 5 years ago. |
|
|
| Back to top |
|
| Ulf |
Posted: Mon Jul 16, 2007 4:28 pm |
|
|
|
User
Joined: 04 Sep 2006
Posts: 42
Location: Göteborg
|
michal wrote: All the applications that are included in the standard OTP tree and have GUIs use the GS. Start the graphical Erlang debugger or TV (used to examine ETS and Mnesia tables) from your Erlang shell to see the GS in action and to decide if that's what you need.
Yes, and GS is really buggy and unstable. Especially in windows but also in GNU/Linux and Xorg, for example it sometimes crash if it doesn't get the size that it request.
I would not consider GS to be stable enough for anything, and I would love to see the graphical debugger and so on being more stable even in none WIMP window managers. |
|
|
| Back to top |
|
| Ulf |
Posted: Mon Jul 16, 2007 4:38 pm |
|
|
|
User
Joined: 04 Sep 2006
Posts: 42
Location: Göteborg
|
| I checked now and it seems that the debugger is more stable since the last time I used it, so maybe they fixed a few things since last year or it might just be certain sizes it doesn't like. |
|
|
| Back to top |
|
| francesco |
Posted: Mon Jul 16, 2007 5:26 pm |
|
|
|
User
Joined: 07 Jul 2006
Posts: 249
Location: London
|
Testing on a windows platform is a low priority for Ericsson and the OTP team, as most of their systems run on UNIX derivatives. Therefore, windows bugs, even if known, have often not been fixed. It got much better in the last major releases, but is still not optimal.
Pman and the Debugger are the first tools ported over to GS and have barely been updated and are certainly not representative (I had to implement several of the GS objects as I ported over pman and the debugger from pxw). Look at table visualizes (tv:start()) or Appmon (appmon:start()) which were both written from scratch a few years later when the GS interface became more stable and representative. (The sad thing was that pman and the debugger worked really well back in 1996. The ultimate test was to recursively trace a pman window in pman )
Other representative GS examples include
Othello: othello:start().
Columns: cols:start().
Bonk: bonk:start().
Mandelbrot: mandel:start().
To run them, make sure you add lib/gs-1.5.5/contribs/ebin/ to your code search path using code:add_pathz/1
Oh, and Mines: http://www.erlang.org/examples/klacke_examples/gsmines.erl
It boils down to what your goal is. A prototype/hobby project or a fully working product. Yes for A, no for B.
Francesco |
|
|
| Back to top |
|
| anderst |
Posted: Tue Jul 17, 2007 8:49 am |
|
|
|
User
Joined: 21 Nov 2006
Posts: 37
|
Quote: Other representative GS examples include
Othello: othello:start().
Columns: cols:start().
Bonk: bonk:start().
Mandelbrot: mandel:start().
To run them, make sure you add lib/gs-1.5.5/contribs/ebin/ to your code search path using code:add_pathz/1
If you are lazy or do not want to play with paths, type toolbar:start(). pick the Add GS contribs and clock on the relevant icons.
Hilsen,
Anders |
|
|
| Back to top |
|
| wuji |
Posted: Sat Sep 15, 2012 4:55 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
guy, how do I get in contact with him?'"Click Here for the the designer replica *beep* the Blotter Homepage. Ellen DeGeneres Reflects on Coming-Out Episode, 15 Years LaterTalk
Host Says She Worried Audience Wouldn't Applaud or Like HerBy BRINDA ADHIKARI ADHIKARI [h1]cheap authentic air jordans[/h1] ADHIKARI and ENJOLI FRANCISMay 4, 2012 Ellen DeGeneres is a powerhouse
these days, associated with a successful talk show, awards shows and talent talent [h1]discount designer *beep*[/h1] talent competitions as well as a serious love for dancing -- something
even shared with President Obama.But 15 years ago, on ABC's "20/20" in in discount designer *beep* in April 1997, days before the airing of the episode in which
announced that she was gay, the funny, kind, brave and huge star star cheap real jordans star of her own show shared her fears of coming out."If they
out I was gay, maybe they wouldn't applaud," she said. "Maybe they they cheap authentic air jordans they wouldn't laugh. Maybe they wouldn't like me if they knew that
was gay."During that April 30, 1997 episode of "The Ellen Show" -- -- cheap real jordans -- called "The Puppy Episode" -- DeGeneres sat across from her psychiatrist, |
|
|
| Back to top |
|
| RichardFudnavis |
Posted: Tue Sep 18, 2012 11:10 am |
|
|
|
Joined: 08 Sep 2012
Posts: 4
Location: 234 Arthurs Pl, Stanardsville, VA 22973
|
I did some tests with XRC (using wxFormBuilder) and it works,
but it takes some time to get used to it. I'm not sure if it
is because of Erlang (or that I am still a rookie), the wxWidgets
framework, or the lack of documentation. |
_________________ nursery wall stickers |
|
| Back to top |
|
|
|