|
|
@@ -2,10 +2,33 @@ import customtkinter as ctk
|
|
|
import json
|
|
|
from PIL import Image, ImageTk
|
|
|
|
|
|
-
|
|
|
+import asyncio
|
|
|
+from bleak import BleakScanner
|
|
|
+from bleak import BleakClient
|
|
|
+
|
|
|
+target_name = "Long name works now"
|
|
|
+
|
|
|
+SERVICE_UUID= "d86aecf2-d87d-489f-b664-b02de82b2fc0"
|
|
|
+CHARACTERISTIC_UUID= "d86aecf2-d87d-489f-b664-b02de82b2fc0"
|
|
|
+
|
|
|
+async def connect():
|
|
|
+ target_address = None
|
|
|
+ devices = await BleakScanner.discover()
|
|
|
+ for d in devices:
|
|
|
+ print(d)
|
|
|
+ if target_name == d.name:
|
|
|
+ target_address = d.address
|
|
|
+ print("found target {} bluetooth device with address {} ".format(target_name,target_address))
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ print("could not find device")
|
|
|
+ return target_address
|
|
|
|
|
|
currentScore = 30
|
|
|
|
|
|
+async def main():
|
|
|
+ await connect()
|
|
|
+
|
|
|
|
|
|
ctk.set_appearance_mode("System") # Modes: system (default), light, dark
|
|
|
ctk.set_default_color_theme("blue") # Themes: blue (default), dark-blue, green
|
|
|
@@ -22,7 +45,7 @@ scores = [1,2,3,4,5]
|
|
|
|
|
|
def placeLeaderboard():
|
|
|
canvas.create_rectangle(0, 0, 500, 500, fill="grey20", width=2) #grey14 to match background
|
|
|
-
|
|
|
+
|
|
|
intx = 0
|
|
|
inty = 80
|
|
|
for i in range(len(names)):
|
|
|
@@ -46,9 +69,9 @@ def placeLeaderboard():
|
|
|
nameEntryButton = ctk.CTkButton(width=50,height=50,text="ENTER",fg_color="green",font=("Arial",20),text_color="gray99", master=app)
|
|
|
nameEntryButton.place(x=980,y=205)
|
|
|
|
|
|
- image = Image.open("./Bell Drawing.png")
|
|
|
+ image = Image.open("./Bell Drawing.png")
|
|
|
photo = ImageTk.PhotoImage(image)
|
|
|
-
|
|
|
+
|
|
|
image_label = ctk.CTkLabel(image=photo,text="",width=20, master=app)
|
|
|
image_label.place(x=1200,y=0)
|
|
|
|
|
|
@@ -67,6 +90,5 @@ placeLeaderboard()
|
|
|
#label.grid(column=0,row=0)
|
|
|
#progressbar.grid(column=25,row=8)
|
|
|
|
|
|
+asyncio.run(main())
|
|
|
app.mainloop()
|
|
|
-
|
|
|
-
|