adedd reconnect to client

This commit is contained in:
Askill 2022-06-19 20:42:01 +02:00
parent 9668282ec3
commit 750678ed82
6 changed files with 61 additions and 17 deletions

16
colorpalette.txt Normal file
View File

@ -0,0 +1,16 @@
#FFFFFF
#E4E4E4
#888888
#222222
#FFA7D1
#E50000
#E59500
#A06A42
#E5D900
#94E044
#02BE01
#00D3DD
#0083C7
#0000EA
#CF6EE4
#820080

View File

@ -0,0 +1,26 @@
<template>
<canvas id="main_canvas" height="1000" width="1000"> </canvas>
</template>
<script>
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
canvas { border: 1px solid black; }
</style>

View File

@ -59,8 +59,9 @@ def closest_match(rgb, color_map):
return min(range(len(rgb_colors)), key=lambda i: eucleadian_distance(rgb, color_map[i]))
async def sender(img):
while True:
try:
async with websockets.connect("ws://localhost:8080/set", timeout=60) as websocket:
while True:
rx = random.randint(0, 999)
ry = random.randint(0, 999)
@ -75,7 +76,8 @@ async def sender(img):
succ = await websocket.recv()
if succ != "0":
print(message, "was not set")
except:
print("reconnecting")
async def client():

BIN
python/images/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
python/images/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
python/images/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB