45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
import tkinter as tk
|
|
import subprocess
|
|
|
|
# Dictionary of applications: key is the button text, value is the command to execute
|
|
applications = {
|
|
"Launch Terminal": ["qterminal"],
|
|
"Launch rqt": ["rqt"],
|
|
"Launch rviz2": ["rviz2"],
|
|
"Launch Gazebo": ["/spawn_drones.sh"],
|
|
"Launch Gazebo Standalone": "gz sim -v4".split(),
|
|
# Add more applications here if needed
|
|
}
|
|
|
|
|
|
# Function to launch an application
|
|
def launch_app(command):
|
|
try:
|
|
subprocess.Popen(command)
|
|
except FileNotFoundError:
|
|
print(
|
|
f"{command[0]} not found. Make sure it's installed and accessible in the PATH."
|
|
)
|
|
|
|
|
|
# Create the main application window
|
|
root = tk.Tk()
|
|
root.title("Spiri SDK Launcher")
|
|
|
|
label = tk.Label(root, text="Spiri Robotics SDK", font=("Arial", 14))
|
|
label.pack(pady=10)
|
|
|
|
# Create and place buttons dynamically based on the dictionary
|
|
for app_name, command in applications.items():
|
|
button = tk.Button(
|
|
root,
|
|
text=app_name,
|
|
command=lambda cmd=command: launch_app(cmd),
|
|
width=20,
|
|
height=2,
|
|
)
|
|
button.pack()
|
|
|
|
# Run the Tkinter main loop
|
|
root.mainloop()
|