Linked Questions

Popular Questions

How do I place my buttons inside the gray frame?

Asked by At

I'm trying to put my 3 buttons inside the gray frame (labeled mainframe), even though I put the parent of the buttons as the frame.

import tkinter

class theUI():
    def __init__(self):
        self.root = tkinter.Tk()
        self.mainframe = tkinter.Frame(self.root, height=300, width=400, bg="gray").pack(side="left")
        tkinter.Button(master=self.mainframe, text="Rock").pack(side="left")
        tkinter.Button(master=self.mainframe, text="Paper").pack()
        tkinter.Button(master=self.mainframe, text="Scissors").pack(side="right")


game = theUI()

I tried using pack and grid but they both gave me the same issue. I just started using tkinter so I'm still learning how the widgets work.

Related Questions