Adam
Adam

Reputation: 31

Creating a grid of Canvases without gaps in tkinter python

I have the following code that generates a grid of canvases but there are spaces between each

from tkinter import *

grid = []

master = Tk()

for n in range(0,10):
    grid.append([])
    for i in range(0,10):
        grid[n].append(Canvas(master, bg="#222", height="20", width="20"))
        grid[n][i].grid(row=n, column=i)

How would I remove these so that it looks like one big canvas?

Here's what it looks like:

Upvotes: 0

Views: 367

Answers (1)

Nae
Nae

Reputation: 15325

Use:

canvas = tkinter.Canvas(...)
canvas['highlightthickness'] = 0

or specifically:

grid[-1][-1]['highlighthickness'] = 0

Upvotes: 1

Related Questions