I am working on a program where it has a scroll able frame using a canvas. But inside this frame I wanted to make a tile set up. But when I tried to space out the columns and rows it does not work. Does anyone see why? I am using the grid geometry manager.
Code:
def fields(self):
frame_row = 0
frame_column = 0
row_count = 0
color = "red"
for i in range(10):
self.frame = Frame(self.bfr2, bg=color, width=229, height=120)
self.frame.grid(row=frame_row, column=frame_column)
self.columnconfigure(frame_column, pad=3) #Where it is supposed to add the padding between the columns.
self.rowconfigure(frame_row, pad=3) #Where it is supposed to add the padding between the rows.
frame_column = frame_column + 1
row_count = row_count + 1
if row_count == 2:
frame_row = frame_row + 1
frame_column = 0
row_count = 0
if color == "red":
color = "green"
else:
color = "red"
if color == "red":
color = "green"
else:
color = "red"
You're creating the frames as children of
self.bfr2
, but you are callingself.row_configure
andself.columnconfigure
instead ofself.bfr2.rowconfigure
andself.bfr2.columnconfigure
. What you're doing is setting the padding for the parent of the containing frame rather than the containing frame.