sxiii icon

SolarHub Alpha

sxiii | PRO | 01/09/18 07:29:27 PM UTC | 0 ⭐ | 425 👁️ | Never ⏰ | []
Python |

880 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/python
from appJar import gui
from time import sleep
import serial
import numpy as np
 
def press(btn):
    print(btn)
 
app = gui("MetaSolar HUB GUI","1280x720")
ser = serial.Serial("/dev/ttyS0", 115200, serial.EIGHTBITS, serial.PARITY_NONE, serial.STOPBITS_ONE, timeout=1)
 
ser.write(b'\x00\x34'); app.setFont("16"); 
app.setSticky("news"); 
app.setExpand("both")
 
#app.addLabel("l1", "Some text", 0)
app.addButton("One", press)
 
app.addLabel("l2", "1", 0, 1)
app.addLabel("l3", "2", 1, 0, 2)
#app.setLabelBg("l1", "red");
app.setLabelBg("l2", "blue");
app.setLabelBg("l3", "green");
#app.getLabelWidget("l3").config(font=("","26",""))
 
sleep(0.1)
 
x=ser.read(80)
words = x.split("\r\n")
 
for x in range(0, 12):
    words[x] = float(words[x])
 
words.remove('');
 
#app.addLabel("data",words[0]*2)
app.setLabel("l3",words)
 
ser.close()
 
app.go()
#sleep(5)

Comments