Space_Monkey
Posts: 4
Joined: Mon Aug 27, 2012 4:44 am

Language to start working with a GUI

Mon Aug 27, 2012 5:10 am

Hello everyone!

I would like to see if I can make an 'advanced alarm clock' with my RPi. So I thought I would start off with just getting it to display a nice big digital clock then move onto, alarms, maybe get it to read out the weather and other fun stuff.

I'm just wondering what language might be good for this sort of application? I have a decent amount of experience with PHP, HTML, javascript and other web languages and although I could probably achieve this in a browser I want to try making a native app.

I have written console apps in java but nothing with a GUI. I also don't mind learning a new language all together.

Are there any resources, websites or languages you would suggest to get this project rolling?

ghans
Posts: 7883
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Language to start working with a GUI

Thu Aug 30, 2012 6:54 pm

If you are into Java , then try Swing (native to Java) or SWT (3rd party) .

Else , you could try C\C++ and almost any kit under the moon.
The foundation itself did heavily promote Qt a while ago.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: Language to start working with a GUI

Sun Sep 02, 2012 2:57 pm

I've just used Python and Tkinter in my first gui evelopment, mind you I did program the RISCOS gui many years ago so I'm not a complete novice. Python has the advantage of being scripted. Tkinter is a simple gui api which needs no IDE, just program it using Idle. There are a couple of tutorials at:

http://www.pythonware.com/library/tkint ... /index.htm

and

http://docs.python.org/library/tkinter.html

The application I wrote is here. It uses many of the Tkinter concepts and nicks quite a bit of code from elsewhere on the web.

https://github.com/KenT2/tboplayer
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

Space_Monkey
Posts: 4
Joined: Mon Aug 27, 2012 4:44 am

Re: Language to start working with a GUI

Mon Sep 03, 2012 6:20 am

Okay cool. Perhaps I should give Python ago, it is a Paspberry Pi after all.

I have been playing around with java and swing, since im learning java at uni at the moment. But swing didn't seem all that easy (not that im looking for an 'easy' way). Also had a look into Qt but it doesn't seem entirely strait forward to get that working with java. So im not sure I think i may just mess about until I'm happy with a particular method.

I think im used to a different design method from web development... Building the static GUI in HTML, making it dynamic with javascript, then building the back-end with PHP.

ghans
Posts: 7883
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Language to start working with a GUI

Mon Sep 03, 2012 6:59 am

AFAIK Qt is meant for C/C++ , but of course there are bindings for Python and others available.
Web development on the Pi is pretty easy. Just apt-get apache2 and the rest and you're ready.
Then you could use the Kiosk mode of your browser.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Language to start working with a GUI

Mon Sep 03, 2012 9:12 pm

I have been spending some time during the past month investigating Java GUI back-ends suitable for ARM SoC and trying to locate performance bottlenecks, I will fill in what i have in mind.
Space_Monkey wrote: I have been playing around with java and swing, since im learning java at uni at the moment. But swing didn't seem all that easy (not that im looking for an 'easy' way).
There exist three alternative Swing implementations that may one day get used to run hardware accelerated Swing on the Pi.
http://brandonborkholder.github.com/glg2d/ - This is the most promising project, GLG2D is a Graphics2D implementation that uses OpenGL to implement basic Java2D drawing functionality. The nice thing is that glg2d uses JogAmp JOGL and JogAmp JOGL is already working on the Pi! With some medium sized porting effort we can move this glg2d project from using the GL2 profile, that only work on desktop OpenGL 2, to the GL2ES2 profile that is using a common subset of OpenGL 2 found on both desktop and mobile.

http://pureswing.advel.cz/ - also one interesting project, unfortunately it is now unmaintained, this project can use the LWJGL Java backend to run OpenGL accelerated Swing. It would first require porting of LWJGL to the Pi and then port PureSwing to use the OpenGL ES variant of LWJGL. Its also possible to port this poject to use JOGL GL2ES2 profile.

A third option is to look into using the OpenJDK 7 Caciocavallo portability layer, OpenJDK developers have used Caciocavallo to make Swing and AWT run in HTML5 browsers and on Haiku-os. It is still unclear if there would be any speed gain to use Caciocavallo on the Pi.
Space_Monkey wrote: Also had a look into Qt but it doesn't seem entirely strait forward to get that working with java.
The best way to access QT from Java is by using QT-Jambi
http://sourceforge.net/projects/qtjambi/
Someone will need to step up and help the QT-Jambi community to setup a armhf build server. With a build server in place would help the QT-Jambi community to perform daily ARM testing. I am sure interaction with this community would make the QT-Jambi bindings run well on the Raspberry Pi.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

Space_Monkey
Posts: 4
Joined: Mon Aug 27, 2012 4:44 am

Re: Language to start working with a GUI

Tue Sep 04, 2012 3:31 am

Interesting stuff, so are you saying swing does not yet support hardware acceleration on the pi? I think for now I might take ghans advice and just build myself a local web app. I just got my pi yesterday and its already running raspbmc nicely as a test. When I get some more time I might look into java or python more.

ghans
Posts: 7883
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Language to start working with a GUI

Tue Sep 04, 2012 5:41 am

There is literally nothing using GPU acceleration except omxplayer , XBMC and some
GLES apps (Quake , for example).

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Language to start working with a GUI

Thu Sep 06, 2012 12:35 pm

Space_Monkey wrote: I think for now I might take ghans advice and just build myself a local web app. I just got my pi yesterday and its already running raspbmc nicely as a test. When I get some more time I might look into java or python more.
I can recommend you to take a look at Processing.
Processing can create both standalone Java applications , JavaScript Html5 application and Android applications using a easy to learn API to creating nice visual applications.
http://processing.org/
The Processing GUI IDE is minimal enough to run well on the Pi.
To quickly download and setup the latest Processing beta1 on the Pi (150Mb) then run:

Code: Select all

wget http://processing.googlecode.com/files/processing-2.0b1-linux32.tgz
tar zxvf processing-2.0b1-linux32.tgz
cd processing-2.0b1
#the 32bit java bundled with Processing do not work on ARM
#so I move it away and let the Processing use the system installed java.
mv java java-x86
./processing
2D processing sketches are working fine out of the box.

Work in progress: I am working on the last bits to enable fully hardware accelerated 3D "P3D" sketches using Jogl on the Pi.
The following lines will update the JogAmp JOGL jars inside processing to the latest version (16Mb):

Code: Select all

cd processing-2.0b1
wget http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
7z x jogamp-all-platforms.7z
cp jogamp-all-platforms/jar/*.jar core/library/
./processing
Hopefully by interacting more with the Processing team will be able to offer an armv6 armhf optimized version of processing in the future with full hardware accelerated support for Video, Serial and OpenGL ES with easy installation directly form the Raspbian archive.
If you run into any issue then report them to the Processing team directly http://code.google.com/p/processing/issues/list and we can work it out from there.

Processing includes *a-lot* of example code and documentation.
Cheers
Xerxes
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

User avatar
TideMan
Posts: 268
Joined: Fri Jun 22, 2012 8:08 am
Location: ChCh, NZ

Re: Language to start working with a GUI

Fri Sep 07, 2012 1:03 am

For clocks and weather displayed on the desktop in the background, I use Conky.
If you wish in this world to advance, your merits you're bound to enhance.
You must stir it and stump it and blow your own trumpet, or trust me you haven't a chance.
Ruddigore, G&S

Return to “General programming discussion”