before stlite
This commit is contained in:
parent
ec7f2deccc
commit
635682cbf9
@ -10,6 +10,15 @@ import pickle
|
||||
import re
|
||||
import webview
|
||||
|
||||
# function generate fibonacci sequence
|
||||
def fibonacci(n):
|
||||
if n == 0:
|
||||
return 0
|
||||
elif n == 1:
|
||||
return 1
|
||||
else:
|
||||
return fibonacci(n-1) + fibonacci(n-2)
|
||||
|
||||
async def scan_for_pi() -> dict():
|
||||
ip = socket.gethostbyname(socket.gethostname())
|
||||
baseIP = '.'.join(ip.split(".")[:3])
|
||||
@ -96,22 +105,34 @@ def main(arg):
|
||||
|
||||
def run():
|
||||
config.set_option('server.headless', True)
|
||||
bootstrap.run(gui.__file__, 'streamlit run gui.py --server.headless True', [], di)
|
||||
# bootstrap.run(gui.__file__, 'streamlit run gui.py --server.headless True', [], di)
|
||||
|
||||
p = multiprocessing.Process(target=run)
|
||||
p.start()
|
||||
# p = multiprocessing.Process(target=run)
|
||||
# p.start()
|
||||
|
||||
import requests
|
||||
# import requests
|
||||
|
||||
while True:
|
||||
try:
|
||||
print(requests.get('http://localhost:8501'))
|
||||
except:
|
||||
continue
|
||||
print('asdf')
|
||||
break
|
||||
# while True:
|
||||
# try:
|
||||
# print(requests.get('http://localhost:8501'))
|
||||
# except:
|
||||
# continue
|
||||
# print('asdf')
|
||||
# break
|
||||
# cli.main_run(str(gui.__file__))
|
||||
webview.create_window('LED Control', 'http://localhost:8501')
|
||||
# from streamlit.web.server import Server
|
||||
# server = Server(gui.__file__, 'streamlit run gui.py --server.headless True')
|
||||
import tornado.web
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
self.write("Hello, world")
|
||||
|
||||
application = tornado.web.Application([
|
||||
(r"/", ), ])
|
||||
application.listen(8888)
|
||||
|
||||
webview.create_window('LED Control', application)
|
||||
webview.start()
|
||||
# proc.terminate()
|
||||
exit()
|
||||
|
||||
@ -42,7 +42,6 @@ def main():
|
||||
def add_to_conf():
|
||||
st.session_state.config['saved'].append(color)
|
||||
|
||||
init = 0
|
||||
if 'config' not in st.session_state:
|
||||
init = 1
|
||||
st.session_state.config = load_config()
|
||||
@ -56,7 +55,8 @@ def main():
|
||||
h = st.slider("Hue", 0.0, 1.0, 0.0, 0.01)
|
||||
s = st.slider("Saturation", 0.0, 1.0, 0.0, 0.01)
|
||||
v = st.slider("Value", 0.0, 1.0, 0.0, 0.01)
|
||||
if init == 0:
|
||||
|
||||
|
||||
r,g,b = colorsys.hsv_to_rgb(h,s,v)
|
||||
color = rgb_to_hex(int(r * 255),int(g * 255),int(b * 255))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user