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

ButtonPanel #21

wants to merge 1 commit into from

Conversation

nnh12
Copy link

@nnh12 nnh12 commented Oct 30, 2020

// this is for the buttons panel
// shows you the different visions taks

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.

lbl = Label(window, text = "Autonomous Mapping", bg = 'red', fg ='white')
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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants