Belekz
Posts: 19
Joined: Tue Jan 31, 2017 8:48 pm

Advanced GUI for Python scripts

Sat Apr 22, 2017 2:24 pm

Hey everyone!

I'm an automation engineer for living and learning Python with the RPi 3 just for fun. I'm learning everything from the Internet to get a working python scripts for the GPIO programming. That works fine, but for real (hobby) projects I want to use an GUI to control the GPIO.

So currently I'm looking for a platform to build my GUI with. There are three requirements for me:

1. Programmable with Python or .NET or C#
2. Possibility to run on PuTTY
3. It needs to be easy to design. I want to drag my objects into the window and not need to specify all parameters by text

By watching YT I meet the Tkinter library for Python scripts, but can't run it over PuTTY and that's an absolute need because I don't use a touch screen for this project. So There is no possibility to run the GUI local. I also notice that some people are using QT for this job, but first I want to know if that's the best option before I try to install QT on the RPi. Because that should be a lot of work and my level is still beginner.

If there is an easy way to get the Tkinter library working over PuTTY I would love to hear that too!

Shoot your ideas! 8-)

Thx a lot!

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

Re: Advanced GUI for Python scripts

Sat Apr 22, 2017 3:19 pm

You might also consider this https://python-gtk-3-tutorial.readthedocs.io/en/latest/
Used in conjunction with glade (the Gtk+ gui designer) you can get your "widget drag and drop" functionality.

As for using PuTTY , I have no idea, never used it, never needed it as all my PCs run Linux of one flavour or another.

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

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Advanced GUI for Python scripts

Sun Apr 23, 2017 7:10 pm

Belekz wrote:If there is an easy way to get the Tkinter library working over PuTTY I would love to hear that too!
Tkinter requires a GUI to display it's stuff, and PuTTY only allows a remote CLI connection.

Real VNC is bundled with Raspbian Jessie theses days, and that will allow a remote GUI connection to & from the Pi, and will display Tkinter stuff.

Hope this helps,
Dave.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Advanced GUI for Python scripts

Sun Apr 23, 2017 9:05 pm

I've used pyqt5 for all of my things. I edit a UI with Qt designer, convert it to a python file with pyuic5 and then make the main GUI code that connects to that. It's really simple and I like it a lot. I feel it's a lot easier than glade also and has a lot of support. See here for an example program:
https://github.com/kusti8/hue-plus
There are 10 types of people: those who understand binary and those who don't.

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: Advanced GUI for Python scripts

Sun Apr 23, 2017 9:12 pm

Replace PuTTY with MobaXterm. As its name implies, the later package is (among many many other things) an X server (for Windows PC). Thus, you can login to your Pi via SSH, with X redirected back to the PC and thus you get X capability. Easier to setup than VNC.
If this post appears in the wrong forums category, my apologies.

User avatar
Gavinmc42
Posts: 4526
Joined: Wed Aug 28, 2013 3:31 am

Re: Advanced GUI for Python scripts

Sun Apr 23, 2017 11:51 pm

Or you could go for a web interface.
HTML5, CSS, JS etc and run a webserver on the Pi.

Start with SimpleHTTPServer.py it is already in Python.
You need to make an index.html file and then start the server in that folder
http://www.pythonforbeginners.com/modul ... ttpserver/

The advantage of doing it this way is the external browser does the rendering for you.
Bit tricky if you want to control from another Pi running a browser as you need to use Chromium if your stuff has JS in it.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Advanced users”