Article 4QYVP display a variable in guizero app?

display a variable in guizero app?

by
RonHof
from LinuxQuestions.org on (#4QYVP)
I have the following code the reads and decodes a string on serial port ttyUSB0:
Code:#!/usr/bin/env python
import time
import serial
import string

ser = serial.Serial(

port='/dev/ttyUSB0',

baudrate = 4800,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
while 1:
Str = ser.readline(8)
Str = Str.decode('cp1252','strict')
print ("decoded string: ")
print (Str) # Print decoded stringand I have the following code to create a guizero app that displays the number 999.99 in this case. It works as expected.
Code:#!/usr/bin/env python

import time, serial, string

from guizero import App, Text
app = App(title="Video Scoreboard", height=300, width=400)

message = Text(app, text="999.99",
size=500,
font="Times New Roman",
color="white",
bg="black"
)
app.display() It works as expected. I'm trying to replace the "999.99" in the app with Str from Str.decode but so far no lucklatest?d=yIl2AUoC8zA latest?i=59uq5oR19BU:4ISW22Js8qI:F7zBnMy latest?i=59uq5oR19BU:4ISW22Js8qI:V_sGLiP latest?d=qj6IDK7rITs latest?i=59uq5oR19BU:4ISW22Js8qI:gIN9vFw59uq5oR19BU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments