Justin Paul
Justin Paul

Reputation: 9

How do i make the top frame cover the whole horizontal space?

How do i make the top frame cover the whole horizontal space Just a small piece of code Although i have used proper size still its not covering the whole area

enter image description here

class Customer:

    def __init__(self,root):
        self.root = root
        self.root.title("Customer Billing System")
        self.root.geometry("1350x750+0+0")
        self.root.config(background="powder blue")

        ABC=Frame(self.root,bg="powder blue",bd=20,relief=RIDGE)
        ABC.grid()
        ABC1 = Frame(ABC,bd=14,width=1350,height=100,padx=10,relief=RIDGE,bg="black")
        ABC1.grid(row=0,column=0,columnspan=4,sticky=W)

        ABC2 = Frame(ABC,bd=14,width=450,height=488,padx=10,relief=RIDGE,bg="cadet blue")
        ABC2.grid(row=1,column=0,sticky=W)

        self.lblTitle = Label(ABC1,textvariable=Date1,font=('arial',30,'bold'),pady=9,bd=5,bg="black",fg="white").grid(row=0,column=0)

        self.lblTitle = Label(ABC1,text="Customer Billing System",font=('arial',30,'bold'),pady=9,bd=5,bg="black",fg="white").grid(row=0,column=1)

        self.lblTitle = Label(ABC1,textvariable=Time1,font=('arial',30,'bold'),pady=9,bd=5,bg="black",fg="white").grid(row=0,column=2)

Upvotes: 0

Views: 63

Answers (1)

Novel
Novel

Reputation: 13729

Don't try to set the height or width of a Frame, because Frames are designed to adjust to the size of what you pack into them so those sizes are almost immediately overwritten. Instead, use the sticky argument to tell the Frame to use the size of it's container instead. In your case, stick to the east and west sides:

ABC1 = Frame(ABC,bd=14,padx=10,relief=RIDGE,bg="black")
ABC1.grid(row=0,column=0,columnspan=4,sticky=E+W)
ABC1.columnconfigure(1, weight=1) # set column 1 (the middle one) to consume extra space.

Upvotes: 1

Related Questions