-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
ButtonPanel #21
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from tkinter import* | ||
|
||
# creating button for autonomous mapping | ||
window = Tk() | ||
window.title("welcome") | ||
window.geometry('300x300') | ||
window.configure(width =50,height = 50, bg='blue') | ||
|
||
lbl = Label(window, text = "Autonomous Mapping", bg = 'red', fg ='white') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
lbl.grid(column=0, row=0) | ||
def clicked(): | ||
lbl.configure(text="Autonomous Mapping (Clicked)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
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() | ||
|
There was a problem hiding this comment.
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.