bigfontcalculator_3.py

Created by wperez274

Created on July 11, 2023

11.3 KB


from math import *
from kandinsky import *
from kandinsky import fill_rect as F
from random import *
from random import randint as RAND
from ion import *
from time import *

BL=(0,)*3
WH=(255,)*3

GR=(230,)*3
RE=(155,0,0)

def dot(x,y,c,fg,bg,t,a,b):
  draw_string(c,0,0,GR,WH)
  fill_rect(x,y,9*t,18*t,bg)
  for v in range(18):
    for u in range(9):
      if get_pixel(u,v)==WH:
        fill_rect(x+u*t,y+v*t,t-a,t-b,fg)
        
  draw_string(" ",0,0,WH,WH)
  
  
def aff(txt,x,y,t,fg,bg=WH,a=1,b=1):
  for (i,c) in enumerate(txt):
    dot(x+i*t*9,y,c,fg,bg,t,a,b)
    
    
x=6

num=0
num_2=0




arith=["*","/","+","-"]

func=0
oper=arith[func]


#//////////////////////////
#paste your theme data here


#theme Defaut = (happy Green)

bg_big= (94, 185, 27)
line_c= (42, 165, 15)
bg_small= (219, 239, 152)

font_c= (255, 255, 255)
font_bg_c= (150, 120, 38)


"""
#theme GameBoy Original

bg_big= (134, 178, 86)
line_c= (170, 176, 192)
bg_small= (64, 67, 81)
font_c= (0, 0, 0)
font_bg_c= (184, 198, 12)
"""

"""
#theme wildwest

bg_big= (123, 44, 27)
line_c= (252, 161, 20)
bg_small= (242, 246, 128)
font_c= (255, 255, 255)
font_bg_c= (244, 160, 18)
"""


"""
#theme 0 = (nice & light)

bg_big= (208, 215, 221)
line_c= (126, 213, 24)
bg_small= (137, 226, 161)
font_c= (255, 255, 255)
font_bg_c= (72, 66, 14)
"""


"""
#theme 1 = (light)

bg_big= (187, 238, 119)
line_c= (15, 114, 0)
bg_small= (209, 253, 233)

font_c= (255, 255, 255)
font_bg_c= (58, 51, 83)
"""

"""

#theme 2 = (light)
bg_big= (219, 246, 205)
line_c= (130, 141, 162)
bg_small= (118, 172, 58)

font_c= (255, 255, 255)
font_bg_c= (77, 25, 24)
"""

"""
#theme 3 = (dark)

bg_big= (21, 23, 50)
line_c= (235, 36, 78)
bg_small= (83, 45, 69)

font_c= (255, 255, 255)
font_bg_c= (144, 72, 73)
"""

"""
#theme 4 = (Cool & medium)

bg_big= (194, 128, 161)
line_c= (0, 20, 23)
bg_small= (43, 205, 224)
font_c= (255, 255, 255)
font_bg_c= (9, 24, 141)

"""

"""
#theme 5 = (Cute & pinkish)

bg_big= (242, 134, 185)
line_c= (189, 64, 139)
bg_small= (75, 103, 224)
font_c= (255, 255, 255)
font_bg_c= (176, 33, 160)
"""


"""
#theme 6 = (Simple & light blue)

bg_big= (25, 172, 254)
line_c= (83, 120, 208)
bg_small= (93, 200, 249)
font_c= (255, 255, 255)
font_bg_c= (60, 2, 223)
"""




def theme_change():
  global bg_big,line_c,bg_small,font_bg_c,font_c


  bg_big=(RAND(0,255),RAND(0,255),RAND(0,255))
  line_c=(RAND(0,255),RAND(0,255),RAND(0,255))
  bg_small=(RAND(0,255),RAND(0,255),RAND(0,255))


  font_bg_c=(RAND(0,255),RAND(0,255),RAND(0,255))
  font_c=choice([(0,)*3,(255,)*3])

  
  F(0,0,322,222,bg_big)
  F(0,77,322,116,line_c)
  F(0,83,322,104,bg_small)


  aff(str(int(num))+arith[0]+str(int(num_2))+"="+str(int(num*num_2)),20,105,3,font_c,font_bg_c)



def clear_scr():
  global bg_big,line_c,bg_small,font_bg_c,font_c

#  F(0,0,322,222,bg_big)
  F(0,83,322,104,bg_small)
#  F(0,77,322,116,line_c)


def refresh():
  global bg_big,line_c,bg_small,font_bg_c,font_c

  aff(str(numbers[num])+" + "+str("2"),20,105,3,font_c,font_bg_c)



F(0,0,322,222,bg_big)
F(0,77,322,116,line_c)
F(0,83,322,104,bg_small)

aff(str(int(num))+arith[0]+str(int(num_2))+"="+str(int(num*num_2)),20,105,3,font_c,font_bg_c)

speed_t=0.2

sleep(0.3)


aff("Multiplication",2,25,2,font_c,font_bg_c)

mynum=[]


while not keydown(KEY_EXE):
  oper=arith[func]
  
  if func==1 and num_2==0:
    num_2=1

#*************************

  if keydown(KEY_MULTIPLICATION):
    func=0
    clear_scr()
    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)
    aff("Multiplication",2,25,2,font_c,font_bg_c)
    
  if keydown(KEY_DIVISION):
    func=1
    clear_scr()

    if func==1 and num_2==0:
      num_2=1

    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    aff("Division",2,25,2,font_c,font_bg_c)

  if keydown(KEY_PLUS):
    func=2
    clear_scr()
    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    aff("Addition",2,25,2,font_c,font_bg_c)

  if keydown(KEY_MINUS):
    func=3
    clear_scr()
    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),20,105,3,font_c,font_bg_c)
    aff("Subtraction",2,25,2,font_c,font_bg_c)



  if keydown(KEY_EE):
    sleep(0.2)
    font_bg_c=(RAND(0,255),RAND(0,255),RAND(0,255))
    font_c=choice([(0,)*3,(255,)*3])
    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)


  if keydown(KEY_ANS):
    sleep(0.2)
    bg_big=(RAND(0,255),RAND(0,255),RAND(0,255))
    line_c=(RAND(0,255),RAND(0,255),RAND(0,255))
    bg_small=(RAND(0,255),RAND(0,255),RAND(0,255))

    F(0, 0, 322, 222,bg_big)
    F(0, 77, 322, 116,line_c)
    F(0, 83, 322, 104,bg_small)

    aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)


#*************************
  if keydown(KEY_UP):
    speed_t-=0.01
    sleep(speed_t)
    if speed_t<0.0005:
      speed_t=0.0005
    num+=1
          
    
    if func==0:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)#(0,0,0))#b=0)
    if func==1:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==2:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==3:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)




  if keydown(KEY_DOWN):
    sleep(0.2)
  
    num-=1
    
    if func==0:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==1:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==2:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==3:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)


  if keydown(KEY_LEFT):
    sleep(0.2)
    num_2-=1
    if func==0:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==1:
      clear_scr()
      if num_2==0:
        num_2=-1
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==2:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==3:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)



  if keydown(KEY_RIGHT):
    sleep(0.2)
    num_2+=1
    if func==0:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)


    if func==1:
      clear_scr()
      if num_2==0:
        num_2=1
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==2:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==3:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    
  if keydown(KEY_TOOLBOX):
    sleep(0.2)
    num=0
    num_2=0
    func=0
    if func==0:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num*num_2)),10,105,3,font_c,font_bg_c)#(0,0,0))#b=0)
    if func==1:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(float(num/num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)
    if func==2:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num+num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    if func==3:
      clear_scr()
      aff(str(int(num))+arith[func]+str(int(num_2))+"="+str(int(num-num_2)),10,105,3,font_c,font_bg_c)#font_c,b=0)

    

  if keydown(KEY_OK):
    sleep(0.2)
    theme_change()
  

  draw_string("[UP][DOWN]ARROWS = [+][-] Num 1",14,1,(255,)*3,(0,0,255))
  draw_string("[TOOLBOX=RESET]",165,20,(155,252,150),(0,0,0))

  draw_string("[ANS]=BG CHANGE",170,39,(255,)*3,(0,)*3)

  draw_string("[x10]=NUM CHANGE",160,59,'orange',(0,0,0))


  draw_string("[OK]=THEME CHANGE",1,204,(0,255,0),(0,0,0))
  draw_string("[EXE]=PRINT",205,204,(155,150,255),(0,0,0))






  if keydown(KEY_ZERO):
    sleep(0.2)
    num_2=num_2*10+0
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)

      
  if keydown(KEY_ONE):
    sleep(0.2)
    num_2=num_2*10+1
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_TWO):
    sleep(0.2)
    num_2=num_2*10+2
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_THREE):
    sleep(0.2)
    num_2=num_2*10+3
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_FOUR):
    sleep(0.2)
    num_2=num_2*10+4
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_FIVE):
    sleep(0.2)
    num_2=num_2*10+5
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_SIX):
    sleep(0.2)
    num_2=num_2*10+6
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_SEVEN):
    sleep(0.2)
    num_2=num_2*10+7
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_EIGHT):
    sleep(0.2)
    num_2=num_2*10+8
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_NINE):
    sleep(0.2)
    num_2=num_2*10+9
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)


  if keydown(KEY_LEFTPARENTHESIS):
    sleep(0.2)
    clear_scr()
    num_2-=0.1
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)

  if keydown(KEY_RIGHTPARENTHESIS):
    sleep(0.2)
    clear_scr()
    num_2+=0.1
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)






  if keydown(KEY_BACKSPACE):
    sleep(0.2)
    num_2=int(num_2/10)
    clear_scr()
    aff(str(int(num))+arith[func]+str(float(num_2))+"="+str(int(num)*float(num_2)),10,105,3,font_c,font_bg_c)

    



#prompt user to proceed to exit
draw_string("Press [OK]",100,190)

print("")  

#print theme_change
print("bg_big=",bg_big)
print("line_c=",line_c)
print("bg_small=",bg_small)
print("font_c=",font_c)
print("font_bg_c=",font_bg_c)

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.