How can we get a layout like this in tkinter using grid?

Akascape

I want a layout like this with the grid method where top part have 2 widgets that fill properly without overlapping and the bottom part have 3 widgets.

I tried using columnspan attribute but it was overlapping.

layout

Bryan Oakley

Use six columns. The two items at the top can take up 3 columns each, the items on the bottom take up two columns each.

import tkinter as tk

root = tk.Tk()
f1 = tk.Frame(root, width=100, height=100, background="red")
f2 = tk.Frame(root, width=100, height=100, background="orange")
f3 = tk.Frame(root, width=100, height=100, background="yellow")
f4 = tk.Frame(root, width=100, height=100, background="green")
f5 = tk.Frame(root, width=100, height=100, background="blue")

f1.grid(row=0, column=0, columnspan=3, sticky="nsew")
f2.grid(row=0, column=3, columnspan=3, sticky="nsew")
f3.grid(row=1, column=0, columnspan=2, sticky="nsew")
f4.grid(row=1, column=2, columnspan=2, sticky="nsew")
f5.grid(row=1, column=4, columnspan=2, sticky="nsew")

root.grid_columnconfigure((0,1,2,3,4,5), weight=1)
root.grid_rowconfigure((0,1), weight=1)

root.mainloop()

screenshot of window

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can we display dynamic grid layout like the attached screenshot also order by number with the help of bootstrap

How can I get a layout like this using flexbox?

In Html using Grid layout how can I make last image align left when we have less than one row of images

How can we get the multiple elements with one expression like using for loop

How can I get a 3 columns by 2 rows symmetrical layout with 5 elements using CSS grid?

tkinter gui layout using frames and grid

Changing the size of a scrollbar in tkinter(using grid layout)

Using Tkinter set() attribute with grid layout in python

How we can write delimiter like sep=, using CsvHelper library?

How can i achieve this layout using css? [Without Grid]

How can I achieve this layout using CSS Grid?

How can I build the layout below using grid display in HTML

How to access cells in a simple grid Layout (Tkinter)

How to create Asymmetric Grid layout like this?

How can we make the work spaces like 2X2 Grid on Ubuntu18.04?

How can i create a terminal like design using tkinter

How to get a layout of Divs that looks like this? Better way than trying to use Ionic Grid?

How to divide space equally between widgets using Grid Layout Python Tkinter

How can I get rid of the previous layout and set new Grid Layout in QMainWindow?

Tkinter Grid Dynamic Layout

Tkinter grid layout in loop

How we can get LetsEncrypt Certificate validated using ELB?

how we can get value from nprinting variable using javascript

how can we get the data list of dist using python

Scrollbar to scroll Text widget, using Grid layout, in Tkinter

How to get yearWeek in python like we get using DateTimeFormatInfo.InvariantInfo.Calendar.GetWeekOfYear() in C#?

How can I make this responsive grid layout?

How can I style grid layout in bootstrap?

How can i create this bootstrap grid layout?