Tkinter help (color) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Tkinter help (color) (/thread-24722.html) |
Tkinter help (color) - Florent - Mar-01-2020 Hi, Thanks to Tkinter, I want to make a green rectangle but even I write " fill='green2' ", my rectangle still black. Extract of my code : maree.create_rectangle(i,j,i+1,j+1,fill = 'green2')I have tried this : Color='green2' maree.create_rectangle(i,j,i+1,j+1,fill = Color)But the rectangle still black. Can anyone help me please ? :) RE: Tkinter help (color) - Larz60+ - Mar-01-2020 you don't show enough code. but what you want to do is similar to: canvas.itemconfig(myrectangle, fill='green2')
RE: Tkinter help (color) - Florent - Mar-01-2020 What I want to do is to colorate an area thanks to a matrix : maree = Canvas(tab,width = n, height = m-1, background = 'dodger blue') for i in range(n): for j in range(m): if C[i][j] == 2: maree.create_rectangle(i,j,i+1,j+1,fill = 'green2') if C[i][j] == 1 : maree.create_rectangle(i,j,i+1,j+1,fill = 'black') |