Wireless Robot: Programming a Python GUI

Making the GUI

We wanted to be able to control the robot remotely so we chose to set up a Raspberry Pi to get the job done. The pi ran a python program for the GUI made with TKinter. All we had to do was use remote desktop viewers that way, we could access the GUI on the pi from an external tablet.

We chose to use TKinter when making the GUI mostly due to ease. We were using Python2 and its built in editor. All it took was importing the TKinter library and we had access to writing with TKinter commands. We simply created a window, added buttons, labels, and a slider, and from there it was a lot of customization. When a button is pressed, it calls the associated method which in turn sends a character to serial.

Here is an example of our GUI code for how a button and its method works:

def moveUp():
 label.config(text = "Moving forward")

button2 = Button(root, text=" ^ ", command=moveUp)
button2.place(x = 200, y = 150)
button2.config(height = 6, width = 15,
 bg = "powder blue", fg = "steel blue")

GUI Screenshot



Video of Working Robot with GUIĀ