My aim is to have a prompt go at the startup, and based on the entered integer, have those many canvases fit in the frame. The frame must have a fixed height (and so should the Canvases), but the width should vary depending on the size of the window and be distributed equally among the canvases.
This works well with upto 4 canvases, after which the canvases do not fit into the max window also.
Plus, why am I not able to see the 20-pixel empty gray frame above and below the canvases, since the height of the canvas is lesser than that of the frame?
from tkinter import *
from tkinter import simpledialog
b=[]
root = Tk()
no_of_players=simpledialog.askinteger(prompt="Enter here", title="No of participants")
status_frame=Frame(root, bg='gray', height=100)
status_frame.pack(fill=X)
for i in range(no_of_players):
c=Canvas(status_frame, bg="orange")
b.append(c)
b[i].pack(side=LEFT,fill=X, expand=True)
root.mainloop()
EDIT
from tkinter import *
from tkinter import simpledialog
b=[]
root = Tk()
no_of_players=simpledialog.askinteger(prompt="Enter here", title="No of participants")
status_frame=Frame(root, bg='gray', height=500)
status_frame.pack(fill=X)
for i in range(no_of_players):
c=Canvas(status_frame, width=1, height=100, bg="orange")
b.append(c)
b[i].pack(side=LEFT,fill=X, expand=True)
root.mainloop()