Go to advanced search

by joelostinspace
Sat Jan 25, 2020 4:05 am
Forum: Python
Topic: adafruit_dht library - cleanup??
Replies: 2
Views: 57

Re: adafruit_dht library - cleanup??

break it up into parts and figure out if it's the temp module or board- or find a different temp module, here's a link to retrieving the temp and humidity naming the gpio pin https://github.com/adafruit/Adafruit_Python_DHT/blob/master/examples/AdafruitDHT.py or here https://tutorials-raspberrypi.com...
by joelostinspace
Sat Jan 25, 2020 1:50 am
Forum: Python
Topic: Python problem
Replies: 2
Views: 66

Re: Python problem

in your favorite interactive prompt or in terminal type python3 >>> n= input('enter a number') enter a number8 >>> type(n) <class 'str'> n is a string >>> for i in range(int(n)): print("Bienvenido a C++") Bienvenido a C++ Bienvenido a C++ Bienvenido a C++ Bienvenido a C++ Bienvenido a C++ Bienvenido...
by joelostinspace
Thu Jan 23, 2020 8:55 pm
Forum: Python
Topic: Fastest blink speed with led.blink?
Replies: 2
Views: 85

Re: Fastest blink speed with led.blink?

gpiozero the blink is controlled by time, amount on\ amount off I doubt your getting 800 cycles per second please show your code def blink(self, on_time=1, off_time=1, n=None, background=True): """ Make the device turn on and off repeatedly. :param float on_time: Number of seconds on. Defaults to 1 ...
by joelostinspace
Sun Jan 19, 2020 3:45 pm
Forum: Python
Topic: 'libEGL warning: DRI2: failed to authenticate' running matplotlib.pylab
Replies: 1
Views: 82

Re: 'libEGL warning: DRI2: failed to authenticate' running matplotlib.pylab

how did you install matplotlib? this looks like your missing dependencies Matplotlib requires the following dependencies: Python (>= 3.6) FreeType (>= 2.3) libpng (>= 1.2) NumPy (>= 1.11) setuptools cycler (>= 0.10.0) dateutil (>= 2.1) kiwisolver (>= 1.0.0) pyparsing Optionally, you can also install...
by joelostinspace
Fri Jan 17, 2020 1:29 am
Forum: Python
Topic: Help writing to DB as part of Raspi.orgs build your weather station project
Replies: 3
Views: 163

Re: Help writing to DB as part of Raspi.orgs build your weather station project

your while statements: while True: start_time = time.time() while time.time() - start_time >= interval: humidity, pressure, temperature = bme280_sensor.read_all() db.INSERT(AMBIENT_TEMPERATURE, AIR_PRESSURE, HUMIDITY) the program never gets the checking the interval and never reading your sensor, et...
by joelostinspace
Thu Jan 16, 2020 2:46 pm
Forum: Python
Topic: Help writing to DB as part of Raspi.orgs build your weather station project
Replies: 3
Views: 163

Re: Help writing to DB as part of Raspi.orgs build your weather station project

first please the Code button when adding any code it retains spacing and it easier to read, you have assigned the data base to database here: database = database.weather() then your write to the data base is db here: db.INSERT(AMBIENT_TEMPERATURE, AIR_PRESSURE, HUMIDITY) try changing it database: da...
by joelostinspace
Thu Jan 16, 2020 5:03 am
Forum: Other projects
Topic: Photo Booth Help
Replies: 136
Views: 15510

Re: Photo Booth Help

possible check your memory in this thread https://www.raspberrypi.org/forums/view ... 47#p717845

Code: Select all

 sudo apt-get install memtester
in teminal, then you can rule out your memory.
by joelostinspace
Wed Jan 15, 2020 5:29 am
Forum: Other projects
Topic: Photo Booth Help
Replies: 136
Views: 15510

Re: Photo Booth Help

@rottiegirl maybe you pi is fried due to excessive heat- try and take a simple photo from time import sleep from picamera import PiCamera import datetime as dt cam= PiCamera() cam.resolution= (1024, 768) cam.start_preview() sleep(3) image_name= dt.datetime.now().strftime('%Y-%m-%d-%H_%M_%S')+'.jpg' ...
by joelostinspace
Sat Jan 04, 2020 9:53 pm
Forum: Python
Topic: Raspberry Snake in Python 2--Game not working, Unknown Error
Replies: 4
Views: 390

Re: Raspberry Snake in Python 2--Game not working, Unknown Error

one small typo:
def gameOver():
gameOverFont = pygame.font.font('freesansbold.ttf', 72)
to:

Code: Select all

def gameOver():
    gameOverFont = pygame.font.Font('freesansbold.ttf', 72)
by joelostinspace
Sat Jan 04, 2020 9:04 pm
Forum: Python
Topic: Using gpiozero with tkinter
Replies: 3
Views: 144

Re: Using gpiozero with tkinter

why not just toggle the led's:

Code: Select all

def opendialog(whichbutton):
   #no dialog used
    LED(whichbutton).toggle()
    
by joelostinspace
Mon Dec 30, 2019 5:47 pm
Forum: Python
Topic: Python3 tkinter on raspberry pi .after method
Replies: 3
Views: 227

Re: Python3 tkinter on raspberry pi .after method

I use a png file jpg doesn't contain an alpha channel check out the documents to convert and strip, or recreate as png.
https://readthedocs.org/projects/pillow ... df/latest/
doubt that it's a Linux problem
by joelostinspace
Sat Dec 28, 2019 11:55 pm
Forum: Python
Topic: Python3 tkinter on raspberry pi .after method
Replies: 3
Views: 227

Re: Python3 tkinter on raspberry pi .after method

it worked for me, removed white background and resized. I made it into a class only but I don't think it should make a difference. The after is used to call a function in a set time- so in your case after 1 second remove the alpha. I commented out the after line and worked the same. I change :self.m...
by joelostinspace
Wed Dec 18, 2019 2:27 pm
Forum: Python
Topic: Outputting text to centre of screen?
Replies: 4
Views: 269

Re: Outputting text to centre of screen?

one more way-

Code: Select all

>>> "{:*^70}".format('hello world')
output:

Code: Select all

'*****************************hello world******************************'
by joelostinspace
Tue Dec 10, 2019 4:35 pm
Forum: Python
Topic: Need help troubleshooting
Replies: 1
Views: 146

Re: Need help troubleshooting

please clarify a couple things- if you are using the led to control the pump switch to Motor or Robot, the led uses pmw probably not great for your pi. your is_held in you function change to if button.is_pressed: check out the documentation https://gpiozero.readthedocs.io/en/stable/recipes.html# las...
by joelostinspace
Tue Dec 10, 2019 4:01 pm
Forum: Python
Topic: Problem at changing button's color and selecting item at dropdown menu
Replies: 1
Views: 113

Re: Problem at changing button's color and selecting item at dropdown menu

in you function you are using a list object to reference the color: buttons_colors .configure(bg= color [1]) def getColor(i): #print(i) global cesta_atual #print(cesta_atual) global buttons_colors global color global cor_sel cor_sel=askcolor() print(cor_sel) color.append(cor_sel) #print(color) #prin...
by joelostinspace
Tue Dec 03, 2019 2:42 am
Forum: Python
Topic: TKINTER GUI and Thread problems
Replies: 2
Views: 167

Re: TKINTER GUI and Thread problems

The threading,Timer function is a great way to time something- this script is for a raspberry pi camera, on my 3 b+ I had allocate 256 split RAM in raspi config advanced good luck- Joe from tkinter import Canvas, Frame, Button, Text, Tk import logging,, threading from time import sleep import dateti...
by joelostinspace
Sat Nov 30, 2019 4:27 am
Forum: Python
Topic: [guizero] import error Drawing [solved]
Replies: 4
Views: 202

Re: [guizero] import error Drawing [Solved]

solved it with- for some reason I thought I had to delete the old version to install the new, my bad-

Code: Select all

sudo pip3 install --upgrade guizero
by joelostinspace
Fri Nov 29, 2019 11:43 pm
Forum: Python
Topic: [guizero] import error Drawing [solved]
Replies: 4
Views: 202

Re: [guizero] import error Drawing

thanks for the replies... ok I have an outdated version 0.6.0 @scotty Check which version of guizero you have AttributeError: module 'guizero' has no attribute '__version__' tried pip and got sudo pip3 install guizero Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requi...
by joelostinspace
Fri Nov 29, 2019 8:22 pm
Forum: Python
Topic: Need help to my GPIOZERO programming
Replies: 2
Views: 143

Re: Need help to my GPIOZERO programming

It may be that when you make a function the elements are private to the function try global using your code- from gpiozero import Button a = Button(2) b= Button(3) def a_callback(): global b b.wait_for_press(60) if b.is_pressed: print("pressed") else: print("not pressed") # Output after 60s as a_cal...
by joelostinspace
Fri Nov 29, 2019 8:10 pm
Forum: Python
Topic: [guizero] import error Drawing [solved]
Replies: 4
Views: 202

[guizero] import error Drawing [solved]

I was reading the docs here: https://lawsie.github.io/guizero/drawing/ and am getting an import error: [ >>> from guizero import App, Drawing Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> from guizero import App, Drawing ImportError: cannot import name 'Drawing' from 'gu...
by joelostinspace
Tue Oct 29, 2019 11:06 pm
Forum: Python
Topic: How do I get the slide show to stop
Replies: 7
Views: 1142

Re: How do I get the slide show to stop

When I run you program in idle and close the window I don't get an error. I also ran it in the terminal and no error. you can always create a button in a toplevel dialog and kill the script that way too. Modified your script to read a directory make a list and scroll through the images. The script i...
by joelostinspace
Fri Oct 25, 2019 11:15 pm
Forum: Python
Topic: I am trying to use "time" to get a section of a program to run for a given amount of time.
Replies: 3
Views: 627

Re: I am trying to use "time" to get a section of a program to run for a given amount of time.

I saw this post on timing https://www.raspberrypi.org/forums/view ... 2&t=152742 check down to the end,
do a search on python time polling, you can also make a count down or up, and there's time.sleep(seconds) may need a thread.

Go to advanced search