picandies
Posts: 110
Joined: Wed Nov 26, 2014 5:13 pm

graphics with a designer

Fri Feb 09, 2018 7:22 pm

I am working on an rpi3 & want to setup some gui control panels. to control I/O, like motors and some relays and 2 pumps..no video or animation, though I might like to plot some data in 3d using matplotlib/scipy.

I am not interested in running on the PC or any other device other than the rpi, and prefer Python. Which packages offer a designer (where you draw the graphics layout)? I've heard of QT, but it requires a license.

Also is there an rpi-oriented listing that compares the features of the potential packages?

User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

Re: graphics with a designer

Fri Feb 09, 2018 7:32 pm

This might be of interest:
"Getting started using GTK+3 with Python."
http://www.peteronion.org.uk/PyGobjectGtk+3/PyGtk.html

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

picandies
Posts: 110
Joined: Wed Nov 26, 2014 5:13 pm

Re: graphics with a designer

Fri Feb 09, 2018 10:12 pm

Thanks PeterO...does GTK have sliders, buttons, knobs & the like? I don't about any of the packages, so saying GTK or GTK+3 means nothing to me. But it sort of llooks like glade can be used to draw your panel & place buttons, sliders etc, correct?

User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

Re: graphics with a designer

Fri Feb 09, 2018 10:26 pm

Gtk is a fully featured GUI tool kit.

Have a look at the tutorial at https://python-gtk-3-tutorial.readthedo ... index.html
You can see all the supported Gtk widget classes here : https://lazka.github.io/pgi-docs/Gtk-3.0/classes.html

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
Paeryn
Posts: 2105
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: graphics with a designer

Fri Feb 09, 2018 10:43 pm

GTK+ is quite well featured https://www.gtk.org/features.php, it's been going about 20 years, and yes, glade is the program that lets you design your UI layout which can then be loaded into your program. Just be aware if you follow various tutorials on the web that some older ones predate version 3 and there were some some changes in 3 that break backwards compatibility.
She who travels light — forgot something.

picandies
Posts: 110
Joined: Wed Nov 26, 2014 5:13 pm

Re: graphics with a designer

Sat Feb 10, 2018 4:46 am

Thanks for the addition GTK info...looks interesting...by the way I Googled some GTK gui control panels & everything looks gray is there a special reason for that? I'd expect color to be used quite a bit for backgrounds, button colors, etc.

The tutorial looks good, is it directly suitable for RPI use? (anything special need done?)...I might look for some other RPi-specific tutorials, then circle back to the mentioned one.

So how does GTK stack up against tkinter & the other packages??? it looks good o me, but I don't have a good baseline to compare.

Also, I see pyGTK...is that more oriented for the RPI, or something else entirely??...I see a lot of ZZZ and pyZZZ things but don't know the significance....maybe just a python version off ZZZ?

User avatar
Paeryn
Posts: 2105
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: graphics with a designer

Sat Feb 10, 2018 5:55 am

pyGTK is the python bindings for GTK+2, for GTK+3 they recommend using the bindings in pyGObject (it provides bindings for other GObject based libraries as well as GTK+).

Tkinter does a similar job for Tcl/Tk as pyGTK/pyGObject does for GTK+, namely provides python bindings for the toolkits. Tcl/Tk is older than GTK+, Tcl is actually an interpreted language in its own right and Tk is an extension to it that provides a GUI library. Tkinter wraps the Tcl/Tk interpreter up and lets you use it from python. Tkinter is the "standard" python GUI in that it is provided in just about every python installation that has a graphical display.

Both GTK+ and Tcl/Tk are fairly platform agnostic (or as much as they can be), what works on the RPi should work equally well on a desktop PC running Linux, Windows, Mac or any other OS.
She who travels light — forgot something.

picandies
Posts: 110
Joined: Wed Nov 26, 2014 5:13 pm

Re: graphics with a designer

Sat Feb 10, 2018 8:20 am

Do any of these have a strong positive or strong negative in running on the rpi? It seems like Tkinter comes built-in (so to speak). Probably need to give the GTK a try.

User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

Re: graphics with a designer

Sat Feb 10, 2018 8:39 am

picandies wrote:
Sat Feb 10, 2018 4:46 am
Thanks for the addition GTK info...looks interesting...by the way I Googled some GTK gui control panels & everything looks gray is there a special reason for that? I'd expect color to be used quite a bit for backgrounds, button colors, etc.
Gtk+ is quite conservative in the use of colour. This was very obvious years ago when Qt first appeared and it's default was to prodice applications that where brightly coloured (and consequently looked like they were designed for 5 year olds :D ).

I write Gtk code in C and Python, and both flavours run unmodified on Mint on x86-64 and on Raspbian on Pi. So you won't find any Pi specific tutorials or documentation.

You might find it a little bit slow on a single core Pi, but on a quad core (PI2,3) it's fine.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

Re: graphics with a designer

Sat Feb 10, 2018 8:44 am

picandies wrote:
Sat Feb 10, 2018 8:20 am
Do any of these have a strong positive or strong negative in running on the rpi? It seems like Tkinter comes built-in (so to speak). Probably need to give the GTK a try.
Tkinter has been the default since forever :D
But don't take too much notice of the "latest update" column on this page https://wiki.python.org/moin/GuiProgramming as the gtk related rows seem old.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

raysan5
Posts: 37
Joined: Tue Sep 30, 2014 4:44 pm
Location: Barcelona
Contact: Website

Re: graphics with a designer

Mon Feb 19, 2018 9:59 am

Just answered a similar question here: viewtopic.php?f=67&t=202012&p=1275332#p1275332

Maybe you could be interested.

Return to “Graphics programming”

Who is online

Users browsing this forum: No registered users and 1 guest