afficher_texte.py

Created by laurent-cortot

Created on November 08, 2019

615 Bytes

Afficher un texte à plusieurs reprise n’importe où à l’écran


from kandinsky import *
from random import *
import time

# Définition des constantes
# Résolution de la NumWorks
xMax = 320
yMax = 240
blanc = color(255,255,255)
bleu = color(0,0,255)

txt=input("Texte à afficher ? ")
nbTour=int(input("Nb d'affichage ?"))

while (nbTour > 0):
  # efface le dessin pour faire le nouveau
#  reset()
  
  # Définition d'un emplacement au hasard
  x=randint(0,xMax)
  y=randint(0,yMax)

  # Tracé du rectangle
  draw_string(txt,x,y)
  
  # Marque une pause
  time.sleep(0.5)
  
  # passe au tour suivant, donc un tour de moins à faire
  nbTour = nbTour - 1

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.