if i enter 3 here , 3 disappears and press enter it goes to userchoice 3 its fine but…
- User
if i enter 3 here , 3 disappears and press enter it goes to user_choice 3 its fine
but when i press 3 or 2 or 1 the entered number disapperas
printer.py:
from itertools import cycle from shutil import get_terminal_size from threading import Thread from time import sleep from printer import Printer
class Loader: def init(self, chan, desc=“Loading…”, end=‘’, timeout=0.1, mode=‘prog’): self.desc = desc self.end = end self.timeout = timeout self.channel = chan
self._thread = Thread(target=self._animate, daemon=True) if mode == ‘std1’: self.steps = [“⢿”, “⣻”, “⣽”, “⣾”, “⣷”, “⣯”, “⣟”, “⡿”] elif mode == ‘std2’: self.steps = [“◜”,“◝”,“◞”,“◟”] elif mode == ‘std3’: self.steps = ["😐 ","😐 ","😮 ","😮 ",“😦 “,“😦 “,“😧 “,“😧 “,“🤯 “,“💥 “,“✨ “,”\u3000 “,”\u3000 “,”\u3000 “] elif mode == ‘prog’: self.steps = [”[∙∙∙]”,”[●∙∙]”,”[∙●∙]”,”[∙∙●]”,”[∙∙∙]”]
self.done = False
def start(self): self._thread = Thread(target=self._animate, daemon=True) self._thread.start() return self
def _animate(self): for c in cycle(self.steps): if self.done: break Printer.print_loader(self.channel, f”\r\t{c} {self.desc} “)
print(f”\r{c} {self.desc}”, end=‘’, flush=True)
sleep(self.timeout)
def enter(self): self.start() return self
def stop(self): self.done = True cols = get_terminal_size((80, 20)).columns Printer.print_loader(self.channel, “\r” + " " * cols)
if self.end != “”: Printer.print_loader(self.channel, f”\r{self.end}”)
def exit(self, exc_type, exc_value, tb):
handle exceptions with those variables ^
self.stop()
if i enter 3 here , 3 disappears and press enter it goes to user_choice 3 its fine
but when i press 3 or 2 or 1 the entered number disapperas
give condition like after pressing like 1 or 2 or 3 then start animation upto 10 seeconds
code:
def get_audio_source_choice(): border = "=" * 50 title = "AUDIO SOURCE SELECTION" padded_title = title.center(len(border)) print(f"\n{border}") print(padded_title) print(border) box_width = max(len(s) for s in ["Microphone - Live audio capture", "Internal Sound - Detect sounds playing internally on the device", "File - Detect through an internally saved file"]) + 6 print("\nPlease select the audio source you'd like to use:\n") print(f"+{'-' * (box_width - 2)}+") print(f"| 1: Microphone - Live audio capture{' ' * (box_width - len(' 1: Microphone - Live audio capture') - 3)}|") print(f"| 2: Internal Sound - Detect sounds playing internally on the device{' ' * (box_width - len(' 2: Internal Sound - Detect sounds playing internally on the device') - 3)}|") print(f"| 3: File - Detect through an internally saved file{' ' * (box_width - len(' 3: File - Detect through an internally saved file') - 3)}|") print(f"+{'-' * (box_width - 2)}+") with Loader(chan="Main", desc="Waiting…", mode='std2') as loader: choice = input("Enter your choice (1, 2, or 3) and press Enter: ") loader.stop()
- Assistant
- User
"time" is not defined
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.