copytxt.py

Created by fime

Created on October 16, 2021

471 Bytes

Fonction draw_string_bigger() qui permet de dessiner un chaine agrandie.

Usage : draw_string_bigger(txt_string : str, x_position : int, y_position : int, size : int, <letter_color : tuple>, <background_color : tuple>)

Warning : don’t use a y position <20.


from kandinsky import *

def draw_string_bigger(txt,ox,oy,size,*colors):
  x,y,s=lambda i:i%10,lambda i:i//10,size
  del size
  for n,char in enumerate(txt):
    buffer=[]
    for i in range(180):buffer.append(get_pixel(n*10+x(i),y(i)))
    draw_string(char,n*10,0,*colors)
    for i in range(180):
      fill_rect(ox+(x(i)+n*10)*s,oy+y(i)*s,s,s,get_pixel(n*10+x(i),y(i)))
      set_pixel(n*10+x(i),y(i),buffer[i])
      
draw_string_bigger ("text",0,20,4)

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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.