Go to advanced search

by MrYsLab
Sun Apr 12, 2020 2:57 pm
Forum: Python
Topic: Modules For Offline Assistant
Replies: 5
Views: 242

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 ...
by MrYsLab
Sat Apr 11, 2020 7:26 pm
Forum: Python
Topic: Making an outbreak statistics screen?
Replies: 7
Views: 610

Re: Making an outbreak statistics screen?

Here is a nice article on web scraping that may be of use.
by MrYsLab
Sat Apr 11, 2020 7:21 pm
Forum: Python
Topic: Issues with setting up an alarm with datetime and ranges
Replies: 36
Views: 1606

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

Here is one solution using the time package: import time # get the current time # z will contain the number of seconds # from 'epoch' time z = time.time() # convert the current time to an ascii string print(time.ctime(z)) # set an alarm delay time_delay = 10 # get the current time again and save it ...
by MrYsLab
Sat Apr 11, 2020 4:17 pm
Forum: Python
Topic: Rotate an arrow shaped filled polygon as dial needle?
Replies: 3
Views: 180

Re: Rotate an arrow shaped filled polygon as dial needle?

Genius? Not quite :) You may be exceeding the capabilities of using the Turtle library. You may wish to look at using something like tkinter or kivy . Here is an https://drive.google.com/file/d/1xs1T2hX2WYKdW4vL_q6m0snJkmwttZ0_/view?usp=sharing of a kivy program using the DSEG7-Classic-Bold.ttf font...
by MrYsLab
Fri Apr 10, 2020 9:59 pm
Forum: Python
Topic: Rotate an arrow shaped filled polygon as dial needle?
Replies: 3
Views: 180

Re: Rotate an arrow shaped filled polygon as dial needle?

I am not sure I understand the constraints of your problem, but does this solve your problem? import turtle wn = turtle.Screen() wn.bgcolor("light blue") wn.title("Indicator") # create an arrow the_pointer = turtle.Turtle() the_pointer.shape = "arrow" # set the arrow's size the_pointer.shapesize(10,...
by MrYsLab
Fri Apr 10, 2020 1:09 pm
Forum: Python
Topic: Tkinter - How to get a slider's value
Replies: 6
Views: 525

Re: Tkinter - How to get a slider's value

To force the value to an int, try doing the following:

Code: Select all

def set_red(value):
    print(value)
    GPIO.output(17, int(value))
Do this for the other 2 colors as well.

Again, if you need help, just ask.

Good luck.
by MrYsLab
Fri Apr 10, 2020 11:40 am
Forum: Python
Topic: Tkinter - How to get a slider's value
Replies: 6
Views: 525

Re: Tkinter - How to get a slider's value

One way to do this is to replace setColor with the following three functions: def set_red(value): print(value) GPIO.output(17, value) def set_green(value): print(value) GPIO.output(27, value) def set_blue(value): print(value) GPIO.output(22, value) And to change the creation of the 3 sliders to: red...
by MrYsLab
Fri Apr 10, 2020 12:32 am
Forum: Python
Topic: Tkinter - How to get a slider's value
Replies: 6
Views: 525

Re: Tkinter - How to get a slider's value

The Scale widget has a method called get. It usually returns a float value so you may need to convert it to an int. You probably want to assign each Scale instance to a separate variable name: red_scale = Scale(win, from_=0, to=255,orient=HORIZONTAL,length=700,bg='red', command = setColor) red_scale...
by MrYsLab
Thu Apr 09, 2020 3:42 pm
Forum: Python
Topic: Python Issue with Pygame: event member not defined
Replies: 1
Views: 149

Re: Python Issue with Pygame: event member not defined

The library you are using is rather old, but the author may still be able to help. You can find his email address here: https://github.com/anttus
by MrYsLab
Thu Apr 09, 2020 3:40 pm
Forum: Python
Topic: Error with threads
Replies: 2
Views: 233

Re: Error with threads

What you might wish to do is to look at this article that has a complete working example. https://medium.com/swlh/lets-write-a-chat-app-in-python-f6783a9ac170 Then compare that to your code and see where things have gone wrong for you. If things then still don't work for you, post again, and I will ...
by MrYsLab
Tue Apr 07, 2020 11:52 am
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 740

Re: Pyton script crashes after 4 hours

At the top of your script add:

Code: Select all

from urllib.error import URLError
And then the exception statement would be:

Code: Select all

except URLError as e:
by MrYsLab
Tue Apr 07, 2020 11:43 am
Forum: Python
Topic: help with threading module and passing global variables
Replies: 8
Views: 3701

Re: help with threading module and passing global variables

In the future, please use the Code tags to format your code. My example above does exactly what you state you are trying to do. Using a class to encapsulate the methods avoids the whole global/non-global mess. If you need a tutorial on using Python classes, here is a useful article https://realpytho...
by MrYsLab
Sun Mar 08, 2020 4:22 pm
Forum: Python
Topic: Pi-Arduino error serial exception.
Replies: 4
Views: 366

Re: Pi-Arduino error serial exception.

Without seeing your code, it is very difficult to diagnose your issue. I suspect it is how you implemented readline_notimeout. I assume you are trying to do an unqualified read. What I mean by "unqualified read", is one that does not check for the presence of data using something like serial_port.in...
by MrYsLab
Thu Feb 13, 2020 4:47 pm
Forum: Python
Topic: pigpio_encoder not installing on Buster
Replies: 19
Views: 1267

Re: pigpio_encoder not installing on Buster

Although I don't own one of those encoders, I was able to install the pigpio_encoder library and import into python3 without issue. Here is what I did: 1. pip3 installed the library. 2. Started python and imported the library. Here is my console output: $ sudo pip3 install pigpio_encoder Looking in ...
by MrYsLab
Wed Feb 12, 2020 2:53 pm
Forum: Python
Topic: Why does my python script work from shell but fail when called by another program?
Replies: 5
Views: 344

Re: Why does my python script work from shell but fail when called by another program?

Is the pi user in the nut group? To check this type:

Code: Select all

id pi
This will list all the groups containing the pi user.
If pi is not part of the nut group, run this command:

Code: Select all

sudo usermod -aG nut pi
Run id again to make sure that pi is now part of the nut group.
by MrYsLab
Tue Nov 05, 2019 12:17 am
Forum: Python
Topic: Permanent Arduino usb address on RPi!
Replies: 3
Views: 803

Re: Permanent Arduino usb address on RPi!

I don't think you can assign a fixed device id, but what you can do is get a list of ports. The list will show the device manufacturer's name, and items such as the device's serial number. Here is a quick example of some code and its output. I have an Arduino Uno connected to ttyACM1: from serial.to...
by MrYsLab
Thu Oct 17, 2019 7:50 pm
Forum: Scratch
Topic: Scratch 3 For Arduino, RPi and ESP-8266 Released
Replies: 0
Views: 2149

Scratch 3 For Arduino, RPi and ESP-8266 Released

Find out how you can control your Raspberry Pi locally or remotely from your PC using Scratch 3. The User's Guide may be found here: https://mryslab.github.io/s3-extend/#. You can also control an Arduino Uno and ESP-8266 and have one microcontroller interacting with another.
by MrYsLab
Wed Oct 16, 2019 6:15 pm
Forum: Python
Topic: Thonny Options: Problem with Alternative interpreter or virtual environment
Replies: 5
Views: 1041

Re: Thonny Options: Problem with Alternative interpreter or virtual environment

I am not sure why you are having problems. I created a directory called .python-virtual-environments and a virtual environment called .env. Here is part of its directory tree after activation: (.env) pi@RPi3BPlus:~ $ tree -a .python-virtual-environments .python-virtual-environments └── .env ├── bin ...
by MrYsLab
Tue Oct 15, 2019 9:52 pm
Forum: Python
Topic: Thonny Options: Problem with Alternative interpreter or virtual environment
Replies: 5
Views: 1041

Re: Thonny Options: Problem with Alternative interpreter or virtual environment

Take a look at this article, I believe it provides what you are seeking. https://www.techcoil.com/blog/how-to-associate-a-python-3-virtual-environment-with-thonny/ I just tried it both with virtualenv and pyenv and it works for both. If you are interested in pyenv which allows you to manage and run ...
by MrYsLab
Thu Sep 26, 2019 3:25 pm
Forum: Python
Topic: VLC Get Frame For OpenCV
Replies: 1
Views: 598

Re: VLC Get Frame For OpenCV

by MrYsLab
Tue Sep 17, 2019 8:29 pm
Forum: Python
Topic: Problem Using Telnet and PIGPIO at the Same Time
Replies: 7
Views: 581

Re: Problem Using Telnet and PIGPIO at the Same Time

If you can, you need to find out the true cause of your issue. Are you entering a single command or entering a command immediately followed by another? If it is a single command, I have no clue. I sincerely doubt that it is an interaction between telnet and pigpiod, since they are using totally diff...
by MrYsLab
Mon Sep 16, 2019 12:46 pm
Forum: Python
Topic: Problem Using Telnet and PIGPIO at the Same Time
Replies: 7
Views: 581

Re: Problem Using Telnet and PIGPIO at the Same Time

Looking at the documentation for the Pi-Somfy project, I am assuming you are putting together the transmitter/oscillator as described. Are you able to use the original Pi-Somfy code with your hardware? If that works, then the radio/oscillator is not the problem. I did not check but are you using the...
by MrYsLab
Thu Sep 12, 2019 8:02 pm
Forum: Python
Topic: Problem Using Telnet and PIGPIO at the Same Time
Replies: 7
Views: 581

Re: Problem Using Telnet and PIGPIO at the Same Time

Have you tried using piscope http://abyz.me.uk/rpi/pigpio/piscope.html to monitor the gpio for output? If you are seeing the waveforms generated when you execute LutronInputSomPi.py, are the waveforms and timing correct? BTW here is a link in the forum on using piscope https://www.raspberrypi.org/fo...
by MrYsLab
Tue Sep 10, 2019 4:36 pm
Forum: Python
Topic: Problem Using Telnet and PIGPIO at the Same Time
Replies: 7
Views: 581

Re: Problem Using Telnet and PIGPIO at the Same Time

Sharing the code sounds like a good idea. If you are going to post it here, please use the "Code" tag as described on this link: https://www.raspberrypi.org/forums/view ... 32&t=84477
by MrYsLab
Wed Sep 04, 2019 6:31 pm
Forum: Python
Topic: How do I make this GUI button run 100 times?
Replies: 2
Views: 294

Re: How do I make this GUI button run 100 times?

Your document does not have public viewing permissions.

Go to advanced search