Closed Commander2022 closed 2 years ago
Can you format that so the code display correctly.
Also you have two
app.after(2000, update_writing)
Try removing the one in the function, it will keep on creating the function (I think) and so never release and exit the function.
Also remove the bug tag until it has been found to be a bug in guizero and not a programming problem (been there done that, made that mistake too)
I fixed the problem by replacing "app.after(2000, update_writing)" with "app.repeat(2000, counter" Also what appears to be happening is I reduce the size of the width and height of the screen app = App(height=1000, width=1000,bg="black")" with "app = App(height=250, width=250,bg="black")" To large a Screen size on the Raspberry Pi plays havoc with the program.
Correction, Replacing "app.after(2000, update_writing)" with "app.repeat(2000, counter)"
Having problems with trying to remove "Bug" and replace with own issue. Also I can not format the program.
@Commander2022 - I have formated the code in your original post and removed the bug
label.
I am a little confused as to what the issue is.
I fixed the problem by replacing ...
Have you resolved this issue?
Also what appears to be happening is I reduce the size of the width and height of the screen app = App(height=1000, width=1000,bg="black")" with "app = App(height=250, width=250,bg="black")"
I was also confused by this statement.
If you believe this is a bug with guizero can you state what you are trying to acheive, what you expect the outcome to be, and what the outcome is. It would also be useful to understand what tasks you have taken to isolate this as an issue with guizero.
For example reading data from a sensor using a short python code. The data read out would freeze after running for ten minutes. The program below would show a large readout off a numerical number so it could be seen from a distance on a screen. The program is reading data from. a Analog to Digital converter interface connected to the Raspberry Pi. Changes made with this # Program is now working fine.
from gpiozero import MCP3008 from guizero import App, Text def update_writing(): # def counter()
R1 = 4700.
R2 = 8200
analog_input = MCP3008(channel=0)
reading = analog_input.value
voltage_adc = reading * 3.3
Voltage = voltage_adc / (R2 / (R1 + R2)).
A=('VOLTAGE')
B=(Voltage)
app.after(2000, update_writing) #. removed this line.
app.after(2000, update_writing) writing1.value = A
writing2.value = B
app = App(height=1000, width=1000,bg="black") #Reduced this to height = 250, width 250 writing1 = Text(app, text='A', color="red",size=250,bg="black") writing2 = Text(app, text="B", color="green",size=130,bg="black") app.after(2000, update_writing) #Changed this line to app.repeat(200, counter) app.display()
Running this program on a Raspberry Pi Model 4 with the latest OS and upgraded GuiZero, the program freezes after 10 mins. There is no error message. What this program dose is read a voltage from a Analog to digital converter. I use this same program to read three time zones without any problems The graphic display is a large numerical display showing the changing data. The program itself between the "##" marks runs without any problems in Python 3.
I seem to find the freezing of the program is because it is running out of memory.
Using the same program to read data from a sensor I have had similar problems.
Any suggestions would be most welcomed.
edited to format code