What is the simplest way of building a GUI in raspberry? - Page 1
Forum section: electronics / general

author: XaviPacheco
author_rank: Regular Contributor
timestamp: October 14, 2018, 09:59:20 pm
content: 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.

author: HB9EVI
author_rank: Frequent Contributor
timestamp: October 14, 2018, 10:09:18 pm
content: 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

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 14, 2018, 10:41:04 pm
content: 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.htmlhttps://github.com/ajstarks/openvg

author: RoGeorge
author_rank: Super Contributor
timestamp: October 14, 2018, 11:00:02 pm
content: Node-REDhttps://nodered.org/

author: technix
author_rank: Super Contributor
timestamp: October 16, 2018, 05:43:22 pm
content: 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.

author: Rasz
author_rank: Super Contributor
timestamp: October 16, 2018, 07:15:46 pm
content: Quote from: technix on October 16, 2018, 05:43:22 pm2 minute boot time

author: technix
author_rank: Super Contributor
timestamp: October 16, 2018, 07:51:23 pm
content: Quote from: Rasz on October 16, 2018, 07:15:46 pmDepending 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.

author: webgiorgio
author_rank: Regular Contributor
timestamp: October 18, 2018, 12:22:50 pm
content: 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 madehttp://www.ingdemurtas.it/en/automation/power-data-logger-with-gui/

author: filssavi
author_rank: Frequent Contributor
timestamp: October 18, 2018, 12:45:02 pm
content: 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 toolIf you are well versed in web developement a web app might be nice,Qt can work well both for c++ and python, ecc eccLast but not least, expect countless flame wars from peoples in different camps

author: XaviPacheco
author_rank: Regular Contributor
timestamp: October 18, 2018, 12:53:04 pm
content: 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.

author: legacy
author_rank: Super Contributor
timestamp: October 18, 2018, 12:57:24 pm
content: define simplewe (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 polygonthat's all, but's that's all we need

author: Berni
author_rank: Super Contributor
timestamp: October 18, 2018, 05:09:02 pm
content: 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 windowshttps://www.raylib.com/examples.htmlhttps://github.com/raysan5/rayguiIts 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.

author: technix
author_rank: Super Contributor
timestamp: October 18, 2018, 05:26:59 pm
content: 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.

author: voltsandjolts
author_rank: Unknown
timestamp: October 20, 2018, 09:24:04 am
content: Another option:https://kivy.org/

author: IconicPCB
author_rank: Super Contributor
timestamp: October 20, 2018, 11:07:59 am
content: look up Gambas..

author: pawelsokolowski
author_rank: Newbie
timestamp: November 18, 2019, 08:06:23 pm
content: SiliconWizard, OpenVG is a nice library, but GUI requires user interaction, do you know any OpenVG mouse procedures ? At least mouseclick on graphical element ?

author: Tadas
author_rank: Contributor
timestamp: November 20, 2019, 01:23:44 pm
content: 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.

author: ehughes
author_rank: Frequent Contributor
timestamp: November 20, 2019, 02:08:29 pm
content: QuoteThis!No need for all the python, html and high level javascript rubbish.There is also littleGvl:https://littlevgl.com/

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 20, 2019, 04:04:09 pm
content: Quote from: pawelsokolowski on November 18, 2019, 08:06:23 pmAs 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.

author: boz
author_rank: Regular Contributor
timestamp: November 21, 2019, 05:57:57 pm
content: I will add Lazarus for completeness. copy paste and run the command line below to installsudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install fpc && sudo apt-get install lazarusI 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 athttps://www.lazarus-ide.org/

author: Berni
author_rank: Super Contributor
timestamp: November 21, 2019, 07:38:57 pm
content: 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.