-1

to make it simple, I ask a simple question,

I want to make 4 buttons, each (full-fill) stays at one corner of the frame container or tkinter window:

button_1 = tkinter.Button(window, text="Button 1")
button_2 = tkinter.Button(window, text="Button 2")
button_3 = tkinter.Button(window, text="Button 3")
button_4 = tkinter.Button(window, text="Button 4")
button_1.grid(row=0, column=0)
button_2.grid(row=0, column=1)
button_3.grid(row=1, column=0)
button_4.grid(row=1, column=1)

However, they are all tiny buttons that stay together at only the top-left corner of the window, they are not full-filling the entire window as supposed.

  • I think this question has been answered. Check out: https://stackoverflow.com/questions/43188810/how-to-make-tkinter-button-widget-take-up-full-width-of-grid – Matthew Sep 06 '20 at 06:07
  • Please read this https://stackoverflow.com/a/63536506/13629335 – Thingamabobs Sep 06 '20 at 06:42
  • Alright thanks, I used the grid_columnconfigure and grid_rowconfigure to do that. I only know the sticky keyword when I asked. – Deer Lawson Sep 23 '20 at 16:30

1 Answers1

0

You can also use btn.place to place button based on coordinate system if you dont want to use grid system.Please check the snippet

Button Corner

from tkinter import *
import tkinter as tk
window = Tk()                 
window.geometry('160x130')             
button1 = Button(window, text="Button 1")
button1.place(x=0,y=0)
button2 = Button(window, text="Button 2")
button2.place(x=100,y=0)
button3 = Button(window, text="Button 3")
button3.place(x=0,y=100)
button4 = Button(window, text="Button 4")
button4.place(x=100,y=100)
window.mainloop() 
Karthik
  • 2,181
  • 4
  • 10
  • 28
  • Place and resize seems to do the job, but what I long for is your grid_columnconfigure and grid_rowconfigure, thank you! – Deer Lawson Sep 23 '20 at 14:53