|
10 | 10 | except ImportError: windows = False
|
11 | 11 | else: windows = True
|
12 | 12 |
|
| 13 | +from .misc import * |
| 14 | +# misc_functions = [ |
| 15 | +# ask_bool, ask_int, wind_getonekey, |
| 16 | +# clearsc, clearinp |
| 17 | +# ] |
| 18 | + |
13 | 19 | colorama.init()
|
14 | 20 |
|
15 | 21 | class Choice:
|
@@ -310,15 +316,6 @@ def progress_bar2(start_time: float, current_time: float = time.time(), timetota
|
310 | 316 | progbarstring = '█' * timepassed + '░' * int(progbarsize - timepassed) + ' ' + str(round(remains, 2)).ljust(ljust, '0') + 's'
|
311 | 317 | return progbarstring
|
312 | 318 |
|
313 |
| -def ask_bool(prompt: str) -> bool: |
314 |
| - try: return {"true": True, "yes": True, "y": True, "false": False, "no": False, "n": False}[input(prompt).lower()] |
315 |
| - except KeyError: print("invalid input") |
316 |
| - |
317 |
| -def ask_int(prompt: str) -> int: |
318 |
| - while True: |
319 |
| - try: return int(input(prompt)) |
320 |
| - except ValueError: print("not a number") |
321 |
| - |
322 | 319 | def printc(n: str, *d, f: bool = False, nc = False, firstclr: object = colored.blue, sepL: int = 0, sepC: str = ' ', Beg: str = colored.green('//|'), BegL: int = 4, end: str = '\n', returnstring: bool = False, stream: None = None) -> str | None:
|
323 | 320 | sep = sepC * sepL; w = ''.join(map(str, d))
|
324 | 321 | if not f:
|
@@ -348,18 +345,4 @@ def formatdict(thing: dict | list , item_color: object = colored.white, key_colo
|
348 | 345 | def printd(n: str, d: str = '', f: bool = False, A: bool = False, sepL: int = 0, sepC: str = ' ', Beg: str = colored.red('>>|'), BegL: int = 4):
|
349 | 346 | if A: printc(n, d, f=f, sepL=sepL, sepC=sepC, Beg=Beg, BegL=BegL)
|
350 | 347 |
|
351 |
| -def wind_getonekey(f: bool = True) -> str: |
352 |
| - if not windows: return '' |
353 |
| - if f: return str(msvcrt.getch(), 'utf-8') |
354 |
| - else: return msvcrt.getch() |
355 |
| - |
356 |
| -def clearsc(type: int = 1): |
357 |
| - if type == 1: print('\033[2J') |
358 |
| - elif type == 2: print('\n' * 25) |
359 |
| - |
360 |
| -def clearinp(t: int = 25, e: bool = False): |
361 |
| - for i in range(t): |
362 |
| - keyboard.press_and_release("\b") |
363 |
| - if e: printc(f"on the {i + 1} backspace") |
364 |
| - |
365 | 348 | if __name__ == '__main__': exit()
|
0 commit comments