Skip to content

Commit

Permalink
add event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ototadana committed Jun 4, 2022
1 parent 8cda7a3 commit 8b41013
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gui.py
Expand Up @@ -17,8 +17,21 @@
window = sg.Window("My Drone", layout)

while True:
msg = ""
event, values = window.read(timeout=1)
if event == sg.WINDOW_CLOSED:
if event == sg.WINDOW_CLOSED or event == "Quit":
break
if event == "OK":
msg = values[0]
if event == "Takeoff":
msg = "takeoff"
if event == "Land":
msg = "land"

if msg == "":
continue

window["sent"].update(msg)
window["recv"].update("ok")

window.close()

0 comments on commit 8b41013

Please sign in to comment.