INNER CODE UNIT · Python

overwrite_prompt

TheAssemblyArmada/Vanilla-Conquer · scripts/tgautil.py:23

def overwrite_prompt(question, default=False):
    prompt = " [Y/n] " if default else " [y/N] "
    while True:
        sys.stdout.write(question + prompt)
        choice = raw_input().lower()
        if choice == '':
            return default
        elif choice == 'y':
            return True
        elif choice == 'n':
            return False
        else:
            sys.stdout.write("\n")

def crop(tga_file):
    with Image.open(tga_file) as image:
        image = image.convert('RGBA')
        alpha = image.split()[-1]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…