My question is that we create columns and rows when using customtkinter. Whenever I use columnspan, the widget takes up space on its own, regardless of the rows and columns I create. For example, I create a row of 100 columns and I add a button to it and I add a grid to the button and I set the columnspan as 2 in the grid, but the button takes up 30 columns of space.
import customtkinter as ctk
window = ctk.CTk()
window.geometry("400x400")
window.columnconfigure(tuple(x for x in range(0,100)), weight=1, uniform="x")
window.rowconfigure(0,weight=1,uniform="x")
ctk.CTkButton(window,fg_color="red").grid(row = 0, column = 0, columnspan = 2,sticky = "nswe")
window.mainloop()
The button occupies two columns. The geometry manager simply compresses the remaining, still empty, columns so that effective information occupies a larger screen surface. You can see this if you fill in the remaining columns.
import customtkinter as ctk
window = ctk.CTk()
window.geometry("400x400")
window.columnconfigure(tuple(x for x in range(0,100)), weight=1, uniform="x")
window.rowconfigure(0,weight=1,uniform="x")
ctk.CTkButton(window,fg_color="red").grid(row = 0, column = 0, columnspan = 2,sticky = "nswe")
for i in range(2, 100):
ctk.CTkButton(window, fg_color="red", text=i).grid(row=0, column=i, sticky="nswe", padx=1)
window.mainloop()