Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ButtonPanel #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions vision/ui/main_window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from tkinter import*

# creating button for autonomous mapping
window = Tk()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put all of this code under one method called run(stream) so that other code can call it.

window.title("welcome")
window.geometry('300x300')
window.configure(width =50,height = 50, bg='blue')

lbl = Label(window, text = "Autonomous Mapping", bg = 'red', fg ='white')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here is a bit repetitive, so it's a good practice to create a helper method like add_button that will handle adding the label and button for you. Then you could just keep calling that method to create all the buttons.

lbl.grid(column=0, row=0)
def clicked():
lbl.configure(text="Autonomous Mapping (Clicked)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be best to keep the label text the same. For now you can replace these methods with pass which will tell python to do nothing when it runs the method. Once the other code gets merged in, you can call it from here.

btn = Button(window, text='Click Me', bg = 'white', fg ='red', command = clicked)
btn.grid(column=1, row=0)

# creating button for non-autonomous mapping
lb2 = Label(window, text = "Non-autonomous Mapping", bg = 'white', fg ='red')
lb2.grid(column=0, row=2)
def clicked():
lb2.configure(text="Non-autonomous Mapping (Clicked)" , bg = 'white', fg ='red')
btn2 = Button(window, text='Click Me', bg = "red", fg = "white", command= clicked)
btn2.grid(column=1, row=2)


# creating a button for Before coral photo
lb3 = Label(window, text = "Before Coral Photo", bg = 'red', fg ='white')
lb3.grid(column=0, row=3)
def clicked():
lb3.configure(text="Before Coral Photo (Clicked)", bg = 'red', fg ='white')
btn3 = Button(window, text='Click Me', bg = "white", fg = "red", command= clicked)
btn3.grid(column=1, row=3)

# creating a button for After Coral Photo
lb4 = Label(window, text = "After Coral Photo", bg = 'white', fg ='red')
lb4.grid(column=0, row=4)
def clicked():
lb4.configure(text="After Coral Photo (Clicked)")
btn4 = Button(window, text='Click Me', bg= "red",fg = "white", command = clicked)
btn4.grid(column=1, row=4)

# creating a button for Capture Subway Car
lb5 = Label(window, text = "Capture Subway Car", bg = 'red', fg ='white')
lb5.grid(column=0, row=5)
def clicked():
lb5.configure(text="Capture Subway Car (Clicked)")
btn5 = Button(window, text='Click Me', bg = 'white', fg = 'red', command= clicked)
btn5.grid(column=1, row=5)

# creating a button for Stitch Subway Car
lb6 = Label(window, text = "Stitch Subway Car", bg = 'white', fg ='red')
lb6.grid(column=0, row=6)
def clicked():
lb6.configure(text="Stich Subway Car (Clicked)")
btn6 = Button(window, text='Click Me', bg = 'red', fg = 'white', command= clicked)
btn6.grid(column=1, row=6)

# creating a button for Switch Camera
lb7 = Label(window, text = "Switch Camera", bg = 'red', fg ='white')
lb7.grid(column=0, row=7)
def clicked():
lb7.configure(text="Switch Camera (Clicked)")
btn7 = Button(window, text='Click Me', bg = 'white', fg ='red', command = clicked)
btn7.grid(column=1, row=7)


window.mainloop()