forked from Chillhopper/emergency_LIMO_main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegui.py
166 lines (141 loc) · 3.51 KB
/
egui.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/env python2
import Tkinter as tk
import numpy as np
import rospy
from std_msgs.msg import Bool
from std_msgs.msg import Int8
def button_clicked(num):
if num == 10:
stop_pub.publish(num)
else:
pub.publish(num)
window = tk.Tk()
window.title("Tourist Attractions")
# IMPORTANT DEFS
pub=rospy.Publisher('/button', Int8, queue_size=1)
stop_pub=rospy.Publisher('/stopButton', Int8, queue_size=1)
rospy.init_node('simple_gui', anonymous=True)
# Calculate the size in pixels for a 20 by 20 cm window
width_pixels = window.winfo_fpixels("20c")
height_pixels = window.winfo_fpixels("20c")
window.minsize(int(width_pixels), int(height_pixels))
# Create a header label
header_label = tk.Label(window, text="Team 3 Limo Navigation", font=("Helvetica", 28, "bold"), fg="#ffffff", bg="#333333")
header_label.pack(pady=20)
# Create a frame to hold the buttons
button_frame = tk.Frame(window, bg="#f2f2f2")
button_frame.pack()
# Create buttons with custom style
button_origin = tk.Button(
button_frame,
text="Origin",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(0),
bg="#0099cc",
fg="white"
)
button_sentosa = tk.Button(
button_frame,
text="Sentosa",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(1),
bg="#0099cc",
fg="white"
)
button_wingsoftime = tk.Button(
button_frame,
text="Wings of Time",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(2),
bg="#0099cc",
fg="white"
)
button_uss = tk.Button(
button_frame,
text="USS",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(3),
bg="#0099cc",
fg="white"
)
button_seaaquarium = tk.Button(
button_frame,
text="SEA Aquarium",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(4),
bg="#0099cc",
fg="white"
)
button_fortsiloso = tk.Button(
button_frame,
text="Fort Siloso",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(5),
bg="#0099cc",
fg="white"
)
button_merlion = tk.Button(
button_frame,
text="Merlion",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(6),
bg="#0099cc",
fg="white"
)
button_rainbow = tk.Button(
button_frame,
text="Rainbow Reef",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(7),
bg="#0099cc",
fg="white"
)
button_ifly = tk.Button(
button_frame,
text="iFly",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(8),
bg="#0099cc",
fg="white"
)
button_stop = tk.Button(
button_frame,
text="STOP",
font=("Helvetica", 16),
width=15,
height=5,
command=lambda: button_clicked(10),
bg="#cc0000",
fg="white"
)
# Pack buttons in a grid layout
button_origin.grid(row=1, column=1, padx=10, pady=10)
button_sentosa.grid(row=2, column=1, padx=10, pady=10)
button_uss.grid(row=1, column=2, padx=10, pady=10)
button_stop.grid(row=0, column=3, padx=10, pady=10)
button_rainbow.grid(row=1, column=0, padx=10, pady=10)
button_ifly.grid(row=0, column=0, padx=10, pady=10)
button_wingsoftime.grid(row=2, column=2, padx=10, pady=10)
button_seaaquarium.grid(row=2, column=0, padx=10, pady=10)
button_fortsiloso.grid(row=0, column=2, padx=10, pady=10)
button_merlion.grid(row=0, column=1, padx=10, pady=10)
window.configure(bg="#f2f2f2")
window.mainloop()