I tried to use moudul random in this code but problem is in word random. I'm not sure how to use random color, width or height of window.
from random import*
colours=["blue","red","yellow","green","purple","orange","violet","gray"]
t=Tk()
t.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t1=Tk()
t1.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t2=Tk()
t2.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t3=Tk()
t3.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t4=Tk()
t4.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t5=Tk()
t5.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t6=Tk()
t6.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t7=Tk()
t7.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t8=Tk()
t8.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t9=Tk()
t9.config(bg=colours[randit(0,7)],width=randit(0,200),height=randit(0,500))
t.mainloop()```
Aucun commentaire:
Enregistrer un commentaire