samedi 20 février 2021

Random size of text in python tkinter

I got HW where I have to draw text everywhere on canvas and it has to be a random colour. I got it till here but I'm struggling with setting text to random size.

import tkinter 
from random import *
canvas= tkinter.Canvas (bg="white" , height = "1000", width ="1000")
canvas.pack()

x=randint(1,900)
y=randint(1,900)
farba=choice(("green","blue","pink","red","orange","violet","black","yellow", ))


canvas.create_text (x,y, text = "Prajem príjemný zvyšok dňa", font = "Calibri",   fill=farba )




Aucun commentaire:

Enregistrer un commentaire