Go to advanced search

by joelostinspace
Tue Dec 10, 2019 4:35 pm
Forum: Python
Topic: Need help troubleshooting
Replies: 1
Views: 69

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: 55

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: 110

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: 109

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: 109

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: 89

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: 109

[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: 948

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: 551

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.
by joelostinspace
Wed Oct 23, 2019 4:26 pm
Forum: Python
Topic: Python - Classes / Objects - I need some beginner help...
Replies: 3
Views: 565

Re: Python - Classes / Objects - I need some beginner help...

A class will help with inheritance.. https://docs.python.org/3.3/tutorial/classes.html you can save the data in a multiple of ways- dictionaries offers a variety of modules to save data- shelve, pickle, json, etc. https://docs.python.org/3/tutorial/datastructures.html Dictionary basics: Master savin...
by joelostinspace
Tue Oct 22, 2019 7:30 pm
Forum: Python
Topic: pi stats RAM processor temp cpu usage GUIZERO
Replies: 0
Views: 443

pi stats RAM processor temp cpu usage GUIZERO

Was reading through the guizero docs and saw the waffle and instantly got hungry and my second thought was would make an interesting display. If you have any suggestions to make it more efficient or less lines of code, Joe from guizero import App, Waffle, PushButton, Text, alerts from time import sl...
by joelostinspace
Mon Oct 21, 2019 2:50 am
Forum: Python
Topic: My first Python app--Age Calculator(need suggestions!)
Replies: 5
Views: 663

Re: My first Python app--Age Calculator(need suggestions!)

input always makes your program more dynamic:

Code: Select all

bm= input('Enter your birth month: ')
bd= input('Enter your birh day: ')
by= input('Enter your birth year: ')
print('month: {0} day: {1} year: {2}'.format(bm,bd,by))
bm bd and by are all strings convert to integer

Code: Select all

int(bm)
by joelostinspace
Sat Oct 19, 2019 3:45 pm
Forum: Python
Topic: What does this error mean (thonny)
Replies: 4
Views: 1027

Re: What does this error mean (thonny)

on linux you can use .gif or .xmb . the error is telling you what it's not a bitmap. You need to convert your current icon to a different format, gimp or equivalent, or create new. Using gif format bitmap There are eight built-in, named bitmaps: 'error', 'gray25', 'gray50', 'hourglass', 'info', 'que...
by joelostinspace
Mon Oct 14, 2019 3:32 pm
Forum: Python
Topic: GUIZERO - input_box = TextBox
Replies: 4
Views: 691

Re: GUIZERO - input_box = TextBox

@lawsie hey thanks for the module and great documentation spent last weekend making apps. Really like that you made all the labels textvariables. Joe
by joelostinspace
Fri Oct 11, 2019 4:13 pm
Forum: Python
Topic: GUIZERO - input_box = TextBox
Replies: 4
Views: 691

Re: GUIZERO - input_box = TextBox

it works for me, I didn't need- : os.system(myCmd) the only thing i see is you need to clear the previous log they get stacked, Create a text box with buttons and use the function to add content... I haven't spent much time w/ quizero seems the set is depreciated: good luck, joe from guizero import ...
by joelostinspace
Wed Oct 09, 2019 5:31 pm
Forum: Python
Topic: Round trip cycle
Replies: 2
Views: 370

Re: Round trip cycle

I've seen this solved multiple ways- use a as a count and all even counts are true and Boolean. I look at this as a Boolean problem and solution: if it's one way then change it, then vice versa. I like to solve these problems with the interrupter so fallow along with your favorite: >>> a= 1 >>> def ...
by joelostinspace
Mon Sep 30, 2019 8:25 pm
Forum: Python
Topic: Detect keypress in Python in a simple way?
Replies: 6
Views: 431

Re: Detect keypress in Python in a simple way?

are you running it in python2.7???
try:

Code: Select all

sudo python3 motor_test.py
show complete error output
by joelostinspace
Sun Sep 29, 2019 3:50 pm
Forum: Python
Topic: guizero key event
Replies: 3
Views: 285

Re: guizero key event

try this in your favorite interactive interpreter -

Code: Select all

>>> import guizero.event as ev
>>> help(ev)
by joelostinspace
Mon Sep 23, 2019 4:57 pm
Forum: Python
Topic: Astro Clock
Replies: 5
Views: 419

Re: Astro Clock

another option is to use a light sensor- aka photo resistor. https://pimylifeup.com/raspberry-pi-light-sensor/

also check out motioneyeos way to this:https://blog.ligos.net/2016-04-18/Day-N ... nEye.html
by joelostinspace
Wed Sep 11, 2019 10:52 pm
Forum: Python
Topic: Python in Raspbian Lite treats input() as a number.
Replies: 7
Views: 364

Re: Python in Raspbian Lite treats input() as a number.

what do do you get in idle? How do convert types?

Code: Select all

>>> n= input()
3
>>> n
'3'
>>> type(n)
by joelostinspace
Thu Sep 05, 2019 7:15 pm
Forum: Python
Topic: Motion sensing code hangs
Replies: 4
Views: 232

Re: Motion sensing code hangs

Hello, I think the problem is in this block of your code: while True: time.sleep(10) the computer just sleeps for 10 second again and again. maybe change it to: try: # Callback activated by flank while True: GPIO.add_event_detect(GPIO_PIR, GPIO.RISING, callback=MOTION) time.sleep(10) except Keyboard...
by joelostinspace
Mon Sep 02, 2019 2:07 pm
Forum: Python
Topic: picamera long shutter
Replies: 2
Views: 185

Re: picamera long shutter

Thanks for the reply, not able to connect to zero now, it's being used as a security cam. But able to connect it to a raspberry pi 4 and it outputs a jpg correctly but hangs or freezes up the desktop. Checking the logs of the 4 i( kernel, message, user) it looks like it could be a memory error, but ...
by joelostinspace
Sun Sep 01, 2019 5:14 pm
Forum: Python
Topic: picamera long shutter
Replies: 2
Views: 185

picamera long shutter

Hello, I just got a raspberry pi camera v2.0 and was running it through the basic recipes and am having a problem with the long shutter one. I've modiefd the original code to help with troubleshooting: from time import sleep from picamera import PiCamera from fractions import Fraction try: cam= PiCa...

Go to advanced search