Quellcode durchsuchen

Added try/except to fix "Thread is configured for Windows GUI but callbacks are not working." error on windows

OP-idk vor 7 Monaten
Ursprung
Commit
d4c6fc9264
2 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen
  1. 0 0
      BellDrawing.png
  2. 13 1
      GUI.py

+ 0 - 0
Bell Drawing.png → BellDrawing.png


+ 13 - 1
GUI.py

@@ -6,6 +6,17 @@ import time
 import asyncio
 from dobluetooth import connect, getData
 
+# This could probably go in dobluetooth.py
+try:
+    from bleak.backends.winrt.util import allow_sta
+    # tell Bleak we are using a graphical user interface that has been properly
+    # configured to work with asyncio
+    allow_sta()
+except ImportError:
+    # other OSes and older versions of Bleak will raise ImportError which we
+    # can safely ignore
+    pass
+
 """
 parse esp32 data string and make each axis and accell data its own varible
 then do math on all those varibles to give us ONE NUMBER from all six numbers
@@ -64,8 +75,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=670,y=205)
 
-    image = Image.open("./Bell Drawing.png")
+    image = Image.open("./BellDrawing.png")
     photo = ImageTk.PhotoImage(image)
+    #ctkphoto = ctk.CTkImage(image)
 
     image_label = ctk.CTkLabel(image=photo,text="",width=10, master=app)
     image_label.place(x=800,y=0)