-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpDown.py
More file actions
31 lines (22 loc) · 758 Bytes
/
UpDown.py
File metadata and controls
31 lines (22 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from mqttClient import MqttClient
import controllerMessages as messages
import tkinter as tk
import json
print("UpDown.py launched")
drive_topic = "sbrick/01/sp/drive"
my_client = MqttClient()
my_client.setup_client()
def UpCallBack():
my_client.publish(drive_topic, json.dumps(messages.getMsgUp(), sort_keys=True))
def DownCallBack():
my_client.publish(drive_topic, json.dumps(messages.getMsgDown(), sort_keys=True))
top = tk.Tk()
top.title("TrailerControl")
frame = tk.Frame(top)
frame.pack()
top.geometry("200x135")
BtnUp = tk.Button(top, text=" Up ", font="Helvetica 50 bold", command=UpCallBack)
BtnUp.pack()
BtnDown = tk.Button(top, text=" Down ", font="Helvetica 60 bold", command=DownCallBack)
BtnDown.pack()
top.mainloop()