cool calculator
from math import * from random import * from random import randint as RINT from kandinsky import * from kandinsky import fill_rect as F from ion import * from time import * EXIT=False a=2 b=3 c=a*b bg= (98, 91, 9) product_screen_c= (8, 66, 104) product_font_c= (126, 246, 234) sel_c= (227, 138, 242) lines_c= (215, 211, 153) line_h= 1 bg= (1, 194, 189) product_screen_c= (31, 228, 208) product_font_c= (26, 15, 28) sel_c= (68, 237, 101) lines_c= (100, 132, 202) line_h= 1 """ if product_font_c[0]+product_font_c[1]+product_font_c[2]<300: product_screen_c=(RINT(200,255),RINT(200,255),RINT(200,255)) if product_font_c[0]+product_font_c[1]+product_font_c[2]>=300: product_screen_c=(RINT(0,70),RINT(0,70),RINT(0,70)) """ def draw_theme(): global bg,lines_c,line_h,product_font_c,product_screen_c # if product_font_c[0]+product_font_c[1]+product_font_c[2]<300: # product_screen_c=(RINT(200,255),RINT(200,255),RINT(200,255)) # if product_font_c[0]+product_font_c[1]+product_font_c[2]>=300: # product_screen_c=(RINT(0,70),RINT(0,70),RINT(0,70)) F(0,0,322,222,bg) F(0,20-line_h,322,line_h,lines_c) F(0,38,322,line_h,lines_c) F(0,50-line_h,322,line_h,lines_c) F(0,68,322,line_h,lines_c) F(0,100-line_h*2,322,line_h*2,lines_c) F(0,128,322,line_h*2,lines_c) F(0,20,322,18,(255,255,255)) F(0,50,322,18,(255,255,255)) F(0,100,322,28,product_screen_c) sel_y=20 draw_theme() while not EXIT: if sel_y==20: F(0,20,322,18,sel_c) if sel_y==50: F(0,50,322,18,sel_c) if sel_y==100: F(0,100,322,3,sel_c) F(0,125,322,3,sel_c) draw_string(str(a),10,20) draw_string(str(b),10,50) draw_string(str(a)+" x "+str(b)+" = "+str(c),10,105,product_font_c,product_screen_c) if not keydown(KEY_LEFT) and not keydown(KEY_RIGHT): t=0.2 if keydown(KEY_LEFT): t-=0.01 sleep(t) if len(str(a)) > 4: a=round(a,4) if len(str(b)) > 4: b=round(b,4) if len(str(c)) > 4: c=round(c,4) if t<0: t=0 if sel_y==20: a-=1 c=a*b if sel_y==50: b-=1 c=a*b if sel_y==100: c-=1 b=c/a if a<1: a=1 if sel_y==100: if b<1: b=1 if c<1: c=1 F(0,20,322,18,(255,255,255)) F(0,50,322,18,(255,255,255)) F(0,105,322,18,product_screen_c) if keydown(KEY_RIGHT): t-=0.01 sleep(t) if len(str(a)) > 4: a=round(a,4) if len(str(b)) > 4: b=round(b,4) if len(str(c)) > 4: c=round(c,4) if t<0: t=0 if sel_y==20: a+=1 c=a*b if sel_y==50: b+=1 c=a*b if sel_y==100: c+=1 if a<1: a=1 if b<1: b=1 b=c/a F(0,20,322,18,(255,255,255)) F(0,50,322,18,(255,255,255)) F(0,100,322,28,product_screen_c) if keydown(KEY_BACKSPACE): sleep(0.25) if sel_y==20: a=0 c=a*b if sel_y==50: b=0 c=a*b if sel_y==100: c=0 b=0 F(0,20,322,18,(255,255,255)) F(0,50,322,18,(255,255,255)) F(0,100,322,28,product_screen_c) if keydown(KEY_DOWN) and sel_y==20: sleep(0.2) sel_y=50 F(0,20,322,18,(255,255,255)) if keydown(KEY_DOWN) and sel_y==50: sleep(0.3) sel_y=100 F(0,50,322,18,(255,255,255)) if keydown(KEY_DOWN) and sel_y==100: sleep(0.3) sel_y=20 F(0,100,322,28,product_screen_c) if keydown(KEY_UP) and sel_y==20: sleep(0.3) sel_y=100 F(0,20,322,18,(255,255,255)) if keydown(KEY_UP) and sel_y==50: sleep(0.2) sel_y=20 F(0,50,322,18,(255,255,255)) if keydown(KEY_UP) and sel_y==100: sleep(0.3) sel_y=50 F(0,100,322,28,product_screen_c) if keydown(KEY_EXE): sleep(0.2) bg=(RINT(0,255),RINT(0,255),RINT(0,255)) lines_c=(RINT(0,255),RINT(0,255),RINT(0,255)) line_h=RINT(1,3) sel_c=(RINT(0,255),RINT(0,255),RINT(0,255)) product_screen_c=(RINT(0,255),RINT(0,255),RINT(0,255)) product_font_c=(RINT(0,255),RINT(0,255),RINT(0,255)) draw_theme() if keydown(KEY_TWO): sleep(0.15) num=2 if keydown(KEY_PLUS): if sel_y==20: a+=num c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,100,322,28,product_screen_c) if sel_y==50: b+=num c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,100,322,28,product_screen_c) if keydown(KEY_MINUS): if sel_y==20: a-=num c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,100,322,28,product_screen_c) if sel_y==50: b-=num c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,100,322,28,product_screen_c) if keydown(KEY_MINUS): if sel_y==20: sleep(0.2) a=-(a) c=-(c) if sel_y==50 or sel_y==100: sleep(0.2) b=-(b) c=-(c) fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,105,322,18,product_screen_c) if keydown(KEY_LEFTPARENTHESIS): t-=0.01 sleep(t) if t<0: t=0 if sel_y==20: a-=0.1 c=a*b if sel_y==50: b-=0.1 c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,105,322,18,product_screen_c) if keydown(KEY_RIGHTPARENTHESIS): t-=0.01 sleep(t) if len(str(a)) > 4: a=round(a,4) if len(str(b)) > 4: b=round(b,4) if len(str(c)) > 4: c=round(c,4) if t<0: t=0 if sel_y==20: a+=0.1 c=a*b if sel_y==50: b+=0.1 c=a*b fill_rect(0,20,322,18,(255,255,255)) fill_rect(0,50,322,18,(255,255,255)) fill_rect(0,105,322,18,product_screen_c) draw_string("[EXE] = Change Theme ",5,158,(200,255,200),(0,0,0)) draw_string("[Ans] = EXIT & Print Theme ",5,178,(0,255,200),(0,0,0)) draw_string("[Arrows] = Select & Num[-][+]",5,200,(0,255,0),(0,0,0)) if keydown(KEY_ANS): EXIT=True fill_rect(0,0,322,222,(0,250,250)) draw_string("PRESS [OK] TO EXIT",50,100) if keydown(KEY_SHIFT): sleep(0.12) r+=1 product_font_c[0]+=r print("") print("//////THEME COLORS//////") print("bg=",bg) print("product_screen_c=",product_screen_c) print("product_font_c=",product_font_c) print("sel_c=",sel_c) print("lines_c=",lines_c) print("line_h=",line_h)