I'm trying to create Conway's Game of Life in python3 using tkinter. I am attempting to initialize all the tiles (like a chessboard for those who don't know of the game of life). The grid is displaying correctly, however, it is way too slow (it takes about 4 or 5 seconds). Here is my code:
for i in range(h):
for j in range(w):
tile = Frame(root, width=30, height=30, bg="#000")
tile.grid(row=i, column=j, padx=1, pady=1)
note: h
and w
values (dictate how many pixels the tiles are wide and tall) aren't very large at all. only like 20x30.
I have found a similar question here, but it sounds like the number of iterations is vastly different:
tkinter is very slow - how to speed it up or use a different library?
Is there something wrong with my implementation or should I resort to an alternate library?
SIDE QUESTION: also with all my tiles named the same exact thing, I'm not sure how to select a single one in order to change its background color.
tile.config(background = "#FFFFFF")