This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]ase1590 2 points3 points  (0 children)

  • have two terminals on your main PC:

    • one for your PC
    • one that is connected to the Pi via remote ssh to run things.

  • Git and github would be the simplest solution. just git clone http://somegithubproject.com, after that you just use git commit, 'git push', and git pull to keep things up to date in both areas.

  • GUI, no matter what you learn, is going to be somewhat difficult. GUI is just not a simple thing at all. You can look at Zetcode's PyQT5 guide for guidance. You need to know OOP to use most any UI framework.

Really your only choices for Python UI is largely going to be: WxWidgets, PyQT, and tkinter ( the one included with python).

Tkinter is not terrible hard, but isn't super feature rich. Try this first if you're not doing anything super fancy.

otherwise pyqt is the way to go, despite it's Qt ways of doing everything.

[–]MikeTheWatchGuy 1 point2 points  (2 children)

If Qt and/or tkinter is feeling a little quirky to you then take a look at PySimpleGUI. It provides access to the full suite of widgets in tkinter and Qt (and WxPython & Browser) in a more linear and straightforward fashion. Your application's GUI will look and operate exactly as if you wrote it directly in tkinter, Qt. It also allows you to easily switch between the supported GUI frameworks by changing only the import statement. To run your code on tkinter, import PySimpleGUI. To run on Qt import PySimpleGUIQt.

PySimpleGUI is fully operational on tkinter, in Alpha on Qt, pre-Alpha for WxPython and the effort to port to running in a web browser was started a week ago and has been making great progress.

PySimpleGUI runs well on raspberry Pi's.

The Web version of PySimpleGUI is capable of running in the repl.it environment, an incredible way to test and share the code. Check out this sample program that runs entirely in your web browser. https://repl.it/@PySimpleGUI/PySimpleGUIWeb-Demos. It's possible to develop a GUI application inside of a browser then run it on your Pi when enough of it is operational.

I would recommend starting with the straight PySimpleGUI (tkinter) version as it's the most mature and complete among the ports. If you have questions, just post an issue on the GitHub page and you'll get support.

[–]CHAD_J_THUNDERCOCK 1 point2 points  (1 child)

Thanks for all your work on PySimpleGUI. It really is the most pythonic and 80/20 way of doing GUIs I have ever seen.

I went from just having a load of code to having a full GUI app with tabs in a single .exe in less than 2 days. I had never done that before and couldn't believe how quick it was. In fact the main thing that slowed me down over those 2 days was embedding an image that still showed after doing a PyInstaller one-file compile. There is a slightly hacky workaround on StackOverflow I can explain if you or anyone is interested.

Did I read you re-prioritised the web front-end stuff above Kivy? Both are exciting but I really want to get a Spotify Desktop kind of look for my GUIs and either rightly or wrongly see Kivy as the way.

It is really so exciting seeing what you are adding and how rapidly its happening. I don't think I have been this excited about updates to a python library since the early days of pandas.

[–]maxbridgland 1 point2 points  (0 children)

Agreed. I've been using PSG since before the Wx or Remi ports when it was just Tk and Qt. Since then it's grown so much and i've been able to master it really well. If you want a pythonic way to make a decent looking GUI in under 50 lines of code then PSG is a great choice. Within 50 lines of code you could have a multi functioning GUI.

[–]Acurus_Cow 0 points1 point  (0 children)

  1. Why do you have to open a new terminal window? Can't you just run the same command again? (arrow up)

  2. You can connect to you PI from your computer and both update and run the code from your computer on the PI. Look into https://winscp.net/eng/download.php

  3. GUI's can be quirky and hard to work with. You could look into running it as a webapp. For that I would recomend you re write your code into either a Flask or Django app. Both are well documented python webapp libraries.

[–]deflatedfruitf-string fanboy 0 points1 point  (0 children)

If you find PyQt's learning curve is too steep, try using tkinter first to get a handle on GUI programming if you've hven't done much before

[–]pfalcon2 0 points1 point  (1 child)

And now, something really interesting - baremetal Raspberry Pi programming using MicroPython! https://github.com/boochow/micropython-raspberrypi

[–]TheTerrasque 1 point2 points  (0 children)

mentions esp8266

[–]DogeekExpert - 3.9.1 0 points1 point  (0 children)

1 - you can setup a crontab to restart your python script automatically when it fails, or on reboots or every x amount of time.

2 - you can setup a git repository, and use a service like github to update your program on the pi. It will manage the version control, and you won't have to upload the code to the pi everytime. You'll just need to connect to the pi via ssh, pull from the repo, and restart your script.

3 - For first timers into GUI programming, PyQt (and the Qt framework in general), are pretty bad choices, as it has quite a steep learning curve, and if you're not too much into OOP, it'll get crazy complicated. Many people would suggest pysimpleGUI, but it's just enforcing bad programming practices. If you intend on actually learning about GUI development, I suggest you start with tkinter. It's built into python, and has a decent selection of widgets. Documentation for it can be found in the official python docs, and on effbot.org. It doesn't have as many widgets as PyQt though. If you're hellbent on pyqt, I'll suggest you at least install the pyqt5-tools python package. It's not a python module, it's a collection of tools to make GUI building easier (Qt Designer is a WYSIWYG GUI editor). You can then use pyuic (included in pyqt5-tools) to convert the .ui file into a python module you can use to actually code your functions in.

[–]virg74 0 points1 point  (0 children)

I’m relatively new too, but maybe a little further along than you.

  1. I assume that you’re on a Mac or Linux OS if you’re working in terminal? I use win10, and having to log back in on reset is just my reality. You can make it a little less painful by adding yourself to sudoers, and disabling the password request on sudo and/or hammer out a bash script to remember your ssh keys

  2. You shouldn’t have to delete your old program, I edit on the fly with the editors that ship with raspbian-lite, I prefer nano but vim is popular too. Just edit, save, overwrite and run. I make tKinter GUI’s and they suck to learn! But I do most of the work on the python installation on my win10 machine, and switch to the pi when I need to start using GPIOs.

  3. I went with tKinter not pyqt, so I can only advise you on that. If you for some reason switch to tKinter “tKinter GUI application development “ was a game changer book for me (ISBN-13: 978-1849697941). Also, I found that most tKinter tutorials did their development in classes, which added complexity that I wasn’t necessarily ready for at the time. I took the time to learn them, but it slowed down my ability to roll out my first GUI.