|
| 1 | +import os,time,math,winsound |
| 2 | + |
| 3 | +text_colour=( |
| 4 | + '\x1b[31m', # index 0 = red |
| 5 | + '\x1b[32m', # index 1 = green |
| 6 | + '\x1b[33m', # index 2 = yellow |
| 7 | + '\x1b[34m', # index 3 = blue |
| 8 | + '\x1b[37m' # index 4 = white |
| 9 | + ) |
| 10 | + |
| 11 | +win_sound=( |
| 12 | + 'Windows Notify System Generic', # index 0 = win_sound |
| 13 | + 'Windows Background', # index 1 = win_sound |
| 14 | + 'Windows Notify Email','BUZZ' # index 2 = win_sound |
| 15 | + ) |
| 16 | + |
| 17 | +text_words=( |
| 18 | + f'\n{text_colour[2]}FANTASTIQUE {text_colour[1]}PLASTIQUE \ |
| 19 | +{text_colour[2]}Easy {text_colour[1]}Mix {text_colour[2]}Converter', # index 0 = text_words |
| 20 | + |
| 21 | + f'\n{text_colour[4]}Liquid Acrylic Mix: 8.oz = (1) Cup', # index 1 = text_words |
| 22 | + |
| 23 | + f'\nLiquid Acrylic Mix: 4.oz = One Half Cup', # index 2 = text_words |
| 24 | + |
| 25 | + f'\nGlow Powder Pigment: 28.349523 Grams = (1) Ounce', # index 3 = text_words |
| 26 | + |
| 27 | + f'\nGlow Powder Pigment: 14.1747615 Grams = One Half Ounce', # index 4 = text_words |
| 28 | + |
| 29 | + f'\nLiquid Acrylic Mix and Glow Powder Pigment Ratios: \ |
| 30 | +(4 = Parts LAM) to (1 = Part GPP)', # index 5 = text_words |
| 31 | + |
| 32 | + f'\n1.0 Ounce = 28.349523 Grams or 28.35 Grams.' # index 6 = text_words |
| 33 | + ) |
| 34 | + |
| 35 | +text_info=( |
| 36 | + f'\n{text_colour[2]}Please Enter Ounce Amount:{text_colour[1]}', # index 0 = text_info |
| 37 | + |
| 38 | + f'\n{text_colour[4]}Press (Enter) to convert again or press (Q) to quit.{text_colour[1]}', # index 1 = text_info |
| 39 | + |
| 40 | + f'\n{text_colour[2]}Thanks for measuring with FANTASTIQUE \ |
| 41 | +PLASTIQUE Easy Mix Converter', # index 2 = text_info |
| 42 | + |
| 43 | + f'\n{text_colour[0]}ERROR! Input numbers only please.', # index 3 = text_info |
| 44 | + |
| 45 | + 'title FANTASTIQUE PLASTIQUE Easy Mix Converter' # index 4 = text_info |
| 46 | + ) |
| 47 | + |
| 48 | +text_works=('cls','q') # clear screen, q = quit |
| 49 | + |
| 50 | +ounce1=float() |
| 51 | +ounce0=float() |
| 52 | +grams0=float(28.349523) |
| 53 | +grams1=round(28.349523,2) |
| 54 | + |
| 55 | +def fan_plast(): |
| 56 | + os.system(text_info[4]) |
| 57 | + while True: |
| 58 | + os.system(text_works[0]) |
| 59 | + winsound.PlaySound(win_sound[0],winsound.SND_ASYNC) |
| 60 | + |
| 61 | + for i in text_words: |
| 62 | + print(i) |
| 63 | + |
| 64 | + try: |
| 65 | + ounce0=float(input(text_info[0]).lower().strip()) |
| 66 | + os.system(text_works[0]) |
| 67 | + for i in text_words: |
| 68 | + print(i) |
| 69 | + |
| 70 | + winsound.PlaySound(win_sound[1],winsound.SND_ASYNC) |
| 71 | + |
| 72 | + print(f'\n{text_colour[2]}{ounce0} Ounce = {text_colour[1]}\ |
| 73 | +{ounce0*grams0} {text_colour[2]}Grams or {text_colour[1]}\ |
| 74 | +{ounce0*grams1} {text_colour[2]}Grams.') |
| 75 | + |
| 76 | + button=input(text_info[1]).lower().strip() |
| 77 | + if button==(''): |
| 78 | + continue |
| 79 | + elif button==(text_works[1]): |
| 80 | + os.system(text_works[0]) |
| 81 | + winsound.PlaySound(win_sound[2],winsound.SND_ASYNC) |
| 82 | + print(text_info[2]) |
| 83 | + time.sleep(3) |
| 84 | + break |
| 85 | + |
| 86 | + except ValueError: |
| 87 | + os.system(text_works[0]) |
| 88 | + |
| 89 | + for i in text_words: |
| 90 | + print(i) |
| 91 | + |
| 92 | + winsound.PlaySound(win_sound[3],winsound.SND_ASYNC) |
| 93 | + |
| 94 | + print(text_info[3]) |
| 95 | + |
| 96 | + time.sleep(2) |
| 97 | + |
| 98 | +fan_plast() |
0 commit comments