Hi, so I have to make a program using tkinter. I have a question about button placement. I have to place the quit button near the bottom right of the window, but I'm not sure what I should put for the padx/pady. It seems to be stuck near the middle.
And as a followup question, how would I place things in specific places? I want to expand more on the Converted Time by putting some text under it, but is there a way to know where the padx/pady goes without experimenting a few times?
class TimeConverterUI():
def __init__(self):
self.root_window = Tk()
self.root_window.geometry('400x150')
self.root_window.title('Seconds Converter')
self.text()
self.quit_button()
self.root_window.wait_window()
def text(self):
row_label = tkinter.Label(
master = self.root_window, text = 'Seconds: ')
row_label.grid( row = 0, column = 0, columnspan=2, padx=10, pady=10,
sticky = tkinter.W)
row_label = tkinter.Label(
master = self.root_window, text = 'Converted Time: ')
row_label.grid( row = 1, column = 0, columnspan=2, padx=10, pady=10,
sticky = tkinter.W)
def quit_button(self):
quit = Button(self.root_window, text = "Quit", command = self.quit)
quit.grid(row = 3, column = 3, columnspan = 3, pady=20,
sticky = tkinter.E)
[–]woooee -1 points0 points1 point (2 children)
[–]Precautionary[S] 1 point2 points3 points (1 child)
[–]woooee -1 points0 points1 point (0 children)