Go to advanced search

by MrYsLab
Fri May 01, 2020 3:05 pm
Forum: Python
Topic: Creating HTML button that uses Python script
Replies: 5
Views: 480

Re: Creating HTML button that uses Python script

If you wish to use flask (overkill for a simple pushbutton IMHO, and still requires HTML knowledge), here is a great article by my friend Marcelo:
https://towardsdatascience.com/python-w ... 8423cc6f5d

For something simple, IMHO you can't beat remi.
by MrYsLab
Wed Apr 29, 2020 11:45 pm
Forum: Python
Topic: Uninstall Python3 to compile new version from source?
Replies: 3
Views: 682

Re: Uninstall Python3 to compile new version from source?

Why remove anything when you can have multiple versions of Python installed and select anyone at any time. Using pyenv https://realpython.com/intro-to-pyenv/ you can even set things up so that when you enter a directory the desired version of Python is automatically selected.
by MrYsLab
Wed Apr 29, 2020 10:17 pm
Forum: Python
Topic: Creating HTML button that uses Python script
Replies: 5
Views: 480

Re: Creating HTML button that uses Python script

Take a look at remi https://github.com/dddomodossola/remi It should solve your problem without the hassle of HTML, CSS and JavaScript. Pure Python delight!.
by MrYsLab
Wed Apr 29, 2020 8:17 pm
Forum: Python
Topic: How to position an "App" window and make it disappear
Replies: 4
Views: 401

Re: How to position an "App" window and make it disappear

I am not sure if this is what you want, but the following code will center the window on the screen and after 4 seconds hide it. This program does not show the screen after the 4 seconds, so it is still running and needs to be closed. Let's talk about the sleep first. Guizero runs in its own loop th...
by MrYsLab
Sun Apr 26, 2020 7:06 pm
Forum: Python
Topic: Progress bar in python output window
Replies: 13
Views: 719

Re: Progress bar in python output window

from stackoverflow: https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console Works in python3 for me. # Print iterations progress def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): """ Call in a loop to crea...
by MrYsLab
Fri Apr 24, 2020 1:14 pm
Forum: Python
Topic: Touchscreen not detecting on_touch_down in kivy - python
Replies: 1
Views: 259

Re: Touchscreen not detecting on_touch_down in kivy - python

It's been quite a while since I played with this, but if you go to this GitHub page: https://github.com/mrichardson23/rpi-kivy-screen and scroll down to item 13 and begin reading from there, the author explains how to enable touch for kivy on the touch display. I have not tried this with Buster but ...
by MrYsLab
Tue Apr 21, 2020 6:09 pm
Forum: Python
Topic: How to change default pip directory from Python 3 to Python 2.7?
Replies: 12
Views: 696

Re: How to change default pip directory from Python 3 to Python 2.7?

If you need to switch between Python environments, either going back and forth between Python 2 and Python3 or wanting to use a newer version of Python than that installed on your distribution, I have found that using the pyenv tool to be a great tool to manage things and keep environments separate ...
by MrYsLab
Tue Apr 21, 2020 11:34 am
Forum: Python
Topic: Thonny/CLI difference - very much beginner
Replies: 4
Views: 241

Re: Thonny/CLI difference - very much beginner

Just to clarify, there are 2 ways to run python from the CLI. One is by simply typing python3 (or python for Python2). This invokes python in an interactive mode, known as the REPL (the READ-EVALUATE-PRINT Loop). The second is to run a program from the CLI. If the name of the file below is add.py th...
by MrYsLab
Mon Apr 20, 2020 8:37 pm
Forum: Python
Topic: Thonny/CLI difference - very much beginner
Replies: 4
Views: 241

Re: Thonny/CLI difference - very much beginner

I am assuming that when you ran the example outside of thonny you did so in the Python REPL. That is you started python by typing in the python or python 3 in the command line and then entered import example example.add(4,5.5) and then hit enter. The REPL prints it results to the console. Thonny is ...
by MrYsLab
Mon Apr 20, 2020 7:56 am
Forum: Python
Topic: Oled interactive menu in python
Replies: 1
Views: 256

Re: Oled interactive menu in python

by MrYsLab
Sun Apr 19, 2020 8:54 pm
Forum: Python
Topic: Python Tkinter and GPIO
Replies: 5
Views: 291

Re: Python Tkinter and GPIO

The problem that the OP is having is not simply controlling GPIO from tkinter, but it is an autostart issue. There are many methods of performing autostart and again, the method you are using is not described within the problem statement. Here are some links that may help you solve your issue: https...
by MrYsLab
Sun Apr 19, 2020 2:40 pm
Forum: Python
Topic: Python Tkinter and GPIO
Replies: 5
Views: 291

Re: Python Tkinter and GPIO

It is very difficult to provide help because there is very little information provided. Could you please: 1. Provide your code (using code tags) 2. If you are trying to start your application from boot, what method are you using? 3. If you are getting exceptions in your code, provide the exception t...
by MrYsLab
Sun Apr 19, 2020 10:30 am
Forum: Python
Topic: Error using ImageMagick in python
Replies: 2
Views: 155

Re: Error using ImageMagick in python

There are several discussions about this on the web. Just google "error/cache.c/OpenPixelCache". Several articles discuss how to configure the ImageMagick cache limits. I have not done this myself, but it looks like a good starting point.
by MrYsLab
Fri Apr 17, 2020 2:16 pm
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

You are correct, you need to move the LED call above the while statement: led = LED(16) while True: t = datetime.now() hournow = str(t.hour) minnow = str(t.minute) secnow = str(t.second) You may also need to do a pip install of rpi.gpio, pigpio, and gpiozero if you are working in a new Python enviro...
by MrYsLab
Thu Apr 16, 2020 10:51 pm
Forum: Scratch
Topic: PWM support for scratch 3?
Replies: 2
Views: 962

Re: PWM support for scratch 3?

Take a look at https://mryslab.github.io/s3-extend/. It supports PWM for the RPi.
by MrYsLab
Thu Apr 16, 2020 5:10 pm
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

The only thing I would caution about is that if you replace the current version of Python, the version of Raspbian you are running may have dependencies upon the originally installed version of Python. I used to recompile and reinstall Python as new versions came out and never had an issue, but usin...
by MrYsLab
Thu Apr 16, 2020 1:13 pm
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

I just installed pyenv on Raspbian Buster without issue. The article I provided the link to is somewhat lengthy, but installing is rather easy. Read the article, but I will summarize what I have done: 1. sudo apt-get update 2. sudo apt-get upgrade 3. sudo apt-get install -y make build-essential libs...
by MrYsLab
Thu Apr 16, 2020 5:47 am
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

There is a tool called pyenv that allows one to have multiple versions of Python available to use on your computer. It allows you to configure a directory to automatically select a specific Python interpreter version just by cd'ing into a directory set up for that interpreter. I believe that it will...
by MrYsLab
Tue Apr 14, 2020 12:31 am
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

The "best approach" is very subjective. My rule of thumb is to write something so that it is easiest for others to understand and for me to maintain. If I need to improve the code for faster execution time, then I use the best approach I can find and document the heck out of it if that approach is s...
by MrYsLab
Mon Apr 13, 2020 6:22 pm
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1586

Re: Issues with setting up an alarm with datetime and ranges

I modified your program somewhat. The first problem is that the while loop was never exited and therefore nothing prints. Also, the values returned by datetime.now are integers and you can't take a length of an integer, so I converted those values to strings. Hopefully this is helpful. from datetime...
by MrYsLab
Mon Apr 13, 2020 12:19 am
Forum: Python
Topic: Modules For Offline Assistant
Replies: 5
Views: 235

Re: Modules For Offline Assistant

Sure. My email address is listed on my GitHub page: https://github.com/MrYsLab
by MrYsLab
Sun Apr 12, 2020 11:42 pm
Forum: Python
Topic: Modules For Offline Assistant
Replies: 5
Views: 235

Re: Modules For Offline Assistant

From a software standpoint, this is all possible. The challenge might be in turning on and off devices (like chargers) from a hardware point of view. The "simple" solution would be to use a bunch of relays. I am not a "hardware guy" and there are probably a lot better ways of isolating the RPi from ...
by MrYsLab
Sun Apr 12, 2020 11:32 pm
Forum: Python
Topic: Making an outbreak statistics screen?
Replies: 7
Views: 604

Re: Making an outbreak statistics screen?

Very nice article. Thanks for the link. If you are going to use the 7" display you can get notifications in Raspberry Pi. I just tried this and it works. Here are the steps I used: Open a command window and type: sudo apt-get install mate-notification-daemon mate-notification-daemon-common Next type...
by MrYsLab
Sun Apr 12, 2020 3:56 pm
Forum: Python
Topic: Making an outbreak statistics screen?
Replies: 7
Views: 604

Re: Making an outbreak statistics screen?

The exception is because the result contains None. I am by no means a beautiful soup, HTML or CSS expert, but I tried the following and it returned the 3 main numbers. Try the following code and see if it gets you any closer. Learning how to parse the HTML tree in soup is somewhat confusing and over...
by MrYsLab
Sun Apr 12, 2020 2:57 pm
Forum: Python
Topic: Modules For Offline Assistant
Replies: 5
Views: 235

Re: Modules For Offline Assistant

That is a huge and complex shopping list :) Here are some links that may help you to get going. Lots of reading ahead :-). tts: https://pypi.org/project/pyttsx3/ speech recognition: https://realpython.com/python-speech-recognition/ audio: https://realpython.com/playing-and-recording-sound-python/ I ...

Go to advanced search