Tkinter: text on canvas

How to write something on the canvas

Until now, ve’ve seen how to draw rectangles and lines on the canvas. Now we want to add text to it (ve’ve seen something in the lesson about moving a square on the screen).

To add a text you simply write:

canvas = tk.Canvas(root, width=400, height=500)
canvas.pack()
canvas.create_text(100,10, text="Hello World!")

This is the result:

text in camvas
text in canvas

Video with the code

Tkinter test for students

Tkinter articles

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.