-1

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"
0Cool
  • 2,335
  • 4
  • 16
  • 16
  • What does "does not work" mean? Does your program crash? Do you get an error? What error? If it doesn't crash, what it is doing that you don't want it to do? – Bryan Oakley Nov 24 '14 at 22:34
  • @BryanOakley In the fields function I am trying to space out the frames I create but it is not spacing them out it is acting as if I did not use rowconfigure and columnconfigure. – 0Cool Nov 24 '14 at 22:35
  • "spacing out" is too vague. Are you wanting to create a checkerboard? A single long row? A single tall column? Do you want space between each colored frame? How much space? – Bryan Oakley Nov 24 '14 at 22:40
  • @BryanOakley Yes I am trying to make it a checker board pattern but with like 3 pixels or 5 between each row and column. – 0Cool Nov 24 '14 at 22:42

1 Answers1

0

You're creating the frames as children of self.bfr2, but you are calling self.row_configure and self.columnconfigure instead of self.bfr2.rowconfigure and self.bfr2.columnconfigure. What you're doing is setting the padding for the parent of the containing frame rather than the containing frame.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685