Author Topic: What is the simplest way of building a GUI in raspberry?  (Read 4773 times)

0 Members and 1 Guest are viewing this topic.

Offline XaviPachecoTopic starter

  • Regular Contributor
  • *
  • Posts: 243
  • Country: do
What is the simplest way of building a GUI in raspberry?
« on: October 14, 2018, 09:59:20 pm »
Is there a way for fastly building a simple GUI in raspberry for someone who has no deep knowledge in this kind of software development? I need to build a simple GUI, i.e, a stopwatch timer triggered by a GPIO. The original idea was to build an application with a menu able to perfom some specific actions. But I have to be honest with myself as I don't have the experience to do it right now. So basically I was looking for another software which helps build GUIs specifically for starters.
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: What is the simplest way of building a GUI in raspberry?
« Reply #1 on: October 14, 2018, 10:09:18 pm »
I'd recommend Python; it's THE language to easily achieve working results in a short time, it has a big community, a simple and comprehensive syntax and it's fun working with
 
The following users thanked this post: alexanderbrevig, XaviPacheco

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What is the simplest way of building a GUI in raspberry?
« Reply #2 on: October 14, 2018, 10:41:04 pm »
If you can develop in C and don't need any fancy UI libraries and ready-made widgets, I suggest taking a look at OpenVG. The RPi comes with OpenVG which is quite easy to use, pretty fast, doesn't need X11 nor any desktop environment and thus is very memory-friendly. Plus it's vector antialiased graphics, so that looks nice. Since it doesn't need X11 nor a DE, you can get access to it very quickly once the boot process is over (just a few seconds after power-on).

Starting points:
http://mindchunk.blogspot.com/2012/09/openvg-on-raspberry-pi.html
https://github.com/ajstarks/openvg
 
The following users thanked this post: XaviPacheco

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6186
  • Country: ro
Re: What is the simplest way of building a GUI in raspberry?
« Reply #3 on: October 14, 2018, 11:00:02 pm »
 
The following users thanked this post: MT, XaviPacheco

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: What is the simplest way of building a GUI in raspberry?
« Reply #4 on: October 16, 2018, 05:43:22 pm »
If you need fancy graphics, you may find writing your project as a Web application a bit easier, since the browser supports all kinds of layout and animation tricks thanks to HTML5 and CSS3.
 

Offline Rasz

  • Super Contributor
  • ***
  • Posts: 2616
  • Country: 00
    • My random blog.
Re: What is the simplest way of building a GUI in raspberry?
« Reply #5 on: October 16, 2018, 07:15:46 pm »
If you need fancy graphics, you may find writing your project as a Web application a bit easier, since the browser supports all kinds of layout and animation tricks thanks to HTML5 and CSS3.

2 minute boot time
Who logs in to gdm? Not I, said the duck.
My fireplace is on fire, but in all the wrong places.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: What is the simplest way of building a GUI in raspberry?
« Reply #6 on: October 16, 2018, 07:51:23 pm »
If you need fancy graphics, you may find writing your project as a Web application a bit easier, since the browser supports all kinds of layout and animation tricks thanks to HTML5 and CSS3.

2 minute boot time
Depending on the stack, it won’t take that longer than a standard desktop. Static files + nginx + FastCGI is fairly quick to start up, PHP is no slouch either if precompiled.
 

Offline webgiorgio

  • Regular Contributor
  • *
  • Posts: 70
  • Country: dk
Re: What is the simplest way of building a GUI in raspberry?
« Reply #7 on: October 18, 2018, 12:22:50 pm »
Python and PyQt.
All the GUI and the program are coded in Python. PyQt is to make the GUI, which pops up when you run the python script. Develop and test your program without PyQt first. Then, when it works, you add the lines of code to make the GUI and display your python variable in a large display.
You can take some example code from this application I made http://www.ingdemurtas.it/en/automation/power-data-logger-with-gui/
 
The following users thanked this post: thinkfat

Offline filssavi

  • Frequent Contributor
  • **
  • Posts: 433
Re: What is the simplest way of building a GUI in raspberry?
« Reply #8 on: October 18, 2018, 12:45:02 pm »
As others said it really depends on many things:

Language, DE, skill set...

for c/c++/python  Gtk is nice, it has also glade a Nice UI designer tool
If you are well versed in web developement a web app might be nice,
Qt can work well both for c++ and python, ecc ecc

Last but not least, expect countless flame wars from peoples in different camps
 

Offline XaviPachecoTopic starter

  • Regular Contributor
  • *
  • Posts: 243
  • Country: do
Re: What is the simplest way of building a GUI in raspberry?
« Reply #9 on: October 18, 2018, 12:53:04 pm »
I just learned how to build a simple GUI using Python-Tkinter. It worked well with raspberry GPIOs and serial port. What I don’t like is the view of the GUI. It actually looks like an old program, no modern at all. But that’s okay for starting. I looked into PyQT5 and it seems more modern. However, I haven’t tried it. I don’t know if GPIOs and serial port would work as they do in Tkinter.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: What is the simplest way of building a GUI in raspberry?
« Reply #10 on: October 18, 2018, 12:57:24 pm »
define simple  :D

we (at DTB) have recently created a super simple engine able to directly access /dev/fb0.
It's able to
- draw lines and polylines
- put some text on the screen
- put a little png image on the screen
- trigger events; like the position of a mouse-click falls inside a polygon

that's all, but's that's all we need :D
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4946
  • Country: si
Re: What is the simplest way of building a GUI in raspberry?
« Reply #11 on: October 18, 2018, 05:09:02 pm »
For making things look fancy you can use Raylib on the Raspberry Pi and combine it with Raygui to get common controls like buttons and text windows
https://www.raylib.com/examples.html
https://github.com/raysan5/raygui

Its a C library that uses OpenGL so it is really fast, but does mean you have to know your way around C quite a bit.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: What is the simplest way of building a GUI in raspberry?
« Reply #12 on: October 18, 2018, 05:26:59 pm »
If you don't mind some tinkering with the libraries, you can run GNUstep + Cairo backend + WindowMaker window manager.

GNUstep actually uses Objective-C language and lacked a good native development environment, however it is largely macOS compatible so you can program and test it using macOS and Xcode. The Cocoa environment supported by GNUstep and macOS has the benefit of requiring WYSIWYG UI design and great flexibility. Using a widget kit does allow you freedom from actually writing drawing and event loop code. Cairo is a fairly lightweight graphics library. WindowMaker is one of the lightest window manager for X and has the OpenStep look and feel, sort of a good fit for macOS-like GNUstep.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2299
  • Country: gb
Re: What is the simplest way of building a GUI in raspberry?
« Reply #13 on: October 20, 2018, 09:24:04 am »
Another option:

https://kivy.org/
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1534
  • Country: au
Re: What is the simplest way of building a GUI in raspberry?
« Reply #14 on: October 20, 2018, 11:07:59 am »
look up Gambas..
 

Offline pawelsokolowski

  • Newbie
  • Posts: 1
  • Country: pl
Re: What is the simplest way of building a GUI in raspberry?
« Reply #15 on: November 18, 2019, 08:06:23 pm »
SiliconWizard, OpenVG is a nice library, but GUI requires user interaction, do you know any OpenVG mouse procedures ? At least mouseclick on graphical element ?
 

Offline Tadas

  • Contributor
  • Posts: 17
Re: What is the simplest way of building a GUI in raspberry?
« Reply #16 on: November 20, 2019, 01:23:44 pm »
I started doing a somewhat similar project (inputs from i2c input expanders + graphical screen) and picked Python (many well supported gpio and peripherals libraries) + pygame (again, well supported on Raspbian with plenty of community articles).

But I wouldn't recommend pygame if you also plan user interactions via mouse or touchscreen. In that case I'd look into pyqt / pygtk and similar.
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 409
  • Country: us
Re: What is the simplest way of building a GUI in raspberry?
« Reply #17 on: November 20, 2019, 02:08:29 pm »
Quote
define simple  :D

we (at DTB) have recently created a super simple engine able to directly access /dev/fb0.
It's able to
- draw lines and polylines
- put some text on the screen
- put a little png image on the screen
- trigger events; like the position of a mouse-click falls inside a polygon

that's all, but's that's all we need :D

This!

No need for all the python, html and high level javascript rubbish.   


There is also littleGvl:

https://littlevgl.com/
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What is the simplest way of building a GUI in raspberry?
« Reply #18 on: November 20, 2019, 04:04:09 pm »
SiliconWizard, OpenVG is a nice library, but GUI requires user interaction, do you know any OpenVG mouse procedures ? At least mouseclick on graphical element ?

As I said, one of the benefits I put forward for using OpenVG is that it woudn't require any desktop environment, and not even X11. So that would be for someone willing a very lightweight solution (and thus very fast power-on to ready-to-go interface), and obviously who can work without X11 and/or fancier libraries handling user input.

AND, not all UIs with a small SBC require user input with a conventional keyboard and mouse; that could be anything else that you'd handle with your own code, like custom buttons, non-standard joysticks, etc. In this case, you're on your own and will have to figure out how to use the GPIOs (/SPI/I2C...) on the RPi.

Now if you absolutely need to handle regular keyboards and mice, it is possible to use OpenVG without X11, but I think it can also be used under X11, in which case you'd have access to the X11 functions for user input. You'd have to learn a bit about X11. A bit more involved.

Obviously, someone not comfortable with this would probably had better use something more high-level, like at least the SDL library, or GLFW+OpenGL (GLFW may be usable with OpenVG but I'm not sure), or higher level such as Qt/GTK/anything else like this.

For the OP's need, which, let's recall, was "a stopwatch timer triggered by a GPIO", I thought talking about OpenVG and a minimal install of Linux was appropriate, as it was the exact case I was talking about above: just a nice display and handling GPIOs. Other user actions could similarly be handled using buttons and GPIOs.
« Last Edit: November 20, 2019, 04:06:59 pm by SiliconWizard »
 

Offline boz

  • Regular Contributor
  • *
  • Posts: 75
  • Country: nz
    • Roving Dynamics Ltd
Re: What is the simplest way of building a GUI in raspberry?
« Reply #19 on: November 21, 2019, 05:57:57 pm »
I will add Lazarus for completeness. copy paste and run the command line below to install

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install fpc && sudo apt-get install lazarus

I use it to develop linux touchscreens and windows desktops and it works fine on all versions of the the RPi and has a very active and helpful community at https://www.lazarus-ide.org/
Fearless diver and computer genius
 
The following users thanked this post: ebclr

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4946
  • Country: si
Re: What is the simplest way of building a GUI in raspberry?
« Reply #20 on: November 21, 2019, 07:38:57 pm »
In linux you can grab input from keyboards, mice, game controllers etc without the full on OpenGL GLFW or X11.

You can do it by opening things in the path /dev/events/. This contains things like mouse0, keyboard, js0... where it barfs out a binary structure holding event data for that device type. This even lets you use multiple mice or multiple keyboards while being able to tell them apart what event came from where. Tho this structure it barfs out can be quite complicated since it supports a whole lot of things like mice with a massive amount of buttons, gamepads with a ridiculous number of axies, touchscreens, multitouch, pen digitizes with pressure control etc... It also barfs out scancodes for keyboard rather than key codes. This does mean you can tell apart the 1 key from the numpad 1 key, or tell apart enter from numpad enter so a table is needed to convert to keycodes for the given keyboard layout (Like US, French, Eastern European...)

It's not all that fun to work with as i found out when rewriting this linux evdev input system for the RayLib library. But this gives RayLib similar benefits as OpenVG in that there is no need for GLFW and it will run straight from a console without X11 installed at all. Yet all standard inputs like keyboard, mice, gamepads, touchscreens... etc will just magicaly work as long as linux drivers for them are working.
 
The following users thanked this post: SiliconWizard


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf