R
R
researcher11112017-06-08 16:44:09
Python
researcher1111, 2017-06-08 16:44:09

Why in tkinter does a button fill the entire frame?

There is this code:

from tkinter import *

root = Tk()
def calc(event):
    calcwind = Toplevel(root,relief=SUNKEN,bd=10,bg="lightblue")
    calcwind.title("Дочернее окно")
    calcwind.minsize(width=400,height=200)
    but1 = Button(calcwind, text = "1", width = 20, height = 50, bg = "white", fg = "black")
    but2 = Button(calcwind, text = "2", width = 20, height = 50, bg = "white", fg = "black")
    but3 = Button(calcwind, text = "3", width = 20, height = 50, bg = "white", fg = "black")
    but4 = Button(calcwind, text = "4", width = 20, height = 50, bg = "white", fg = "black")
    but5 = Button(calcwind, text = "5", width = 20, height = 50, bg = "white", fg = "black")
    but6 = Button(calcwind, text = "6", width = 20, height = 50, bg = "white", fg = "black")
    but7 = Button(calcwind, text = "7", width = 20, height = 50, bg = "white", fg = "black")
    but8 = Button(calcwind, text = "8", width = 20, height = 50, bg = "white", fg = "black")
    but9 = Button(calcwind, text = "9", width = 20, height = 50, bg = "white", fg = "black")
    but0 = Button(calcwind, text = "0", width = 20, height = 50, bg = "white", fg = "black")
    calcwind.pack()
fra1=Frame(root, bg = 'green', width = 600, height = 70)
but = Button(fra1, width = 40, height = 40)
fra1.pack(side = 'bottom')
but.pack(side = 'bottom')
but.bind ("<Button-1>", calc)

root.mainloop()

But the but button fills the entire panel at startup. How to avoid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aristarkh Deryapa, 2017-06-18
@isisTance

What should be filled in? Frame?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question