chatgpt.py

Created by maelg0000

Created on December 11, 2025

2.32 KB


import kandinsky
from kandinsky import fill_rect as f,draw_string as s
from ion import *
N,B,G=(0,0,0),(255,255,255),(140,140,140)
scrw,scrh,txtw,txth=320,222,11,18
def d(t,x,y):
 p=[[B,B,B,B,B,B,N,N,N,N,B,B,B,B,B,B,B,B],
    [B,B,B,B,B,N,N,B,B,G,N,G,N,B,B,B,B,B],
    [B,B,B,B,N,B,B,B,B,N,N,N,N,N,N,B,B,B],
    [B,B,B,N,N,B,B,B,N,N,B,B,B,B,B,N,B,B],
    [B,N,N,G,N,B,N,N,B,B,B,N,B,B,B,N,N,B],
    [B,N,B,G,N,B,N,B,B,B,N,B,N,N,B,B,N,B],
    [N,B,B,G,N,B,N,B,N,N,B,B,B,N,N,N,N,B],
    [N,B,B,G,N,B,N,N,B,B,N,N,B,B,B,N,N,B],
    [N,B,B,G,N,B,N,B,B,B,B,N,N,N,B,B,N,B],
    [B,N,B,B,N,N,N,B,B,B,B,N,B,N,G,B,B,N],
    [B,N,N,B,B,B,N,N,B,B,N,N,B,N,G,B,B,N],
    [B,N,N,N,N,B,B,B,N,N,B,N,B,N,G,B,B,N],
    [B,N,B,B,N,N,B,N,B,B,B,N,B,N,G,B,N,B],
    [B,N,N,B,B,B,N,B,B,B,N,N,B,N,G,N,N,B],
    [B,B,N,B,B,B,B,B,N,N,B,B,B,N,N,B,B,B],
    [B,B,B,N,N,N,N,N,N,B,B,B,B,N,B,B,B,B],
    [B,B,B,B,B,N,G,N,G,B,B,N,N,B,B,B,B,B],
    [B,B,B,B,B,B,B,B,N,N,N,N,B,B,B,B,B,B]]
 u=t/4.0
 for i,r in enumerate(p):
  for j,c in enumerate(r):
   for a in range(4):
    for b in range(4):f(int(x+j*u+a*u/4),int(y+i*u+b*u/4),1,1,c)
 s("ChatGPT",int(x+18*u)+4,int(y+9*u-9))
 
d(6,0,0)
text="How can I help you today?"
s(text,scrw//2-len(text)*txtw//2,100)
f(40,190,230,30,B)
f(41,191,228,28,G)
f(275,190,30,30,N)
for i in range(6):f(288-i*1,198+i*1,2,2,B)
for i in range(6):f(288+i*1,198+i*1,2,2,B)
f(288,198,2,15,B)

km = {
    KEY_EXP: "A", KEY_LN: "B", KEY_LOG: "C", KEY_IMAGINARY: "D", KEY_COMMA: "E",
    KEY_POWER: "F", KEY_SINE: "G", KEY_COSINE: "H", KEY_TANGENT: "I", KEY_PI: "J",
    KEY_SQRT: "K", KEY_SQUARE: "L", KEY_SEVEN: "M", KEY_EIGHT: "N", KEY_NINE: "P",
    KEY_LEFTPARENTHESIS: "Q", KEY_FOUR: "R", KEY_FIVE: "S", KEY_SIX: "U",
    KEY_ONE: "W", KEY_TWO: "X", KEY_THREE: "Y", KEY_ZERO: "?", KEY_DOT: ".",
    KEY_EE: "!"
}

inp = ""
lk = []

while True:
    for k in km:
        if keydown(k) and k not in lk:
            lk.append(k)
            inp += km[k]
            f(41,191,228,28,G)
            s(inp,45,197,B,G)
    
    # Gestion du backspace
    if keydown(KEY_BACKSPACE) and KEY_BACKSPACE not in lk:
        lk.append(KEY_BACKSPACE)
        if len(inp) > 0:
            inp = inp[:-1]  # supprime le dernier caractère
            f(41,191,228,28,G)
            s(inp,45,197,B,G)
    
    for k in lk[:]:
        if not keydown(k):
            lk.remove(k)

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.