def string_parser(user_input): """ This is arguably the most complicated function... It filters the input through removing spaces and lowering text Then, it figures out which meal the user is inquiring about. After, the command text is removed from the user input only leaving the user's name. This is then checked against the member list to confirm the identity at which point the location of the name is found in the unadjusted list. If the name is not currently on the meal specific list, then it is added, and the new table is drawn in the output. """ input_filtered = user_input.replace(" ", "").lower() if "!botlunch" in input_filtered: # Removing bot meal call to only retain users name potential_name = input_filtered[len("!botlunch"):] if potential_name in member_list: match_index = [i for i, s in enumerate(member_list) if potential_name in s] member_name = unadjusted_member_list[match_index[0]+1] if member_name not in lunch_list: lunch_list.append(member_name) lunch_output_table.add_row([[str(member_name)]]) clear() print(text.Text("LATE PLATE BOT", color='0000ff', shadow=True, skew=5)) print(lunch_output_table.draw()) print(dinner_output_table.draw()) message_send('Gotcha ' + member_name + ' you are on the lunch list!') else: message_send("You're already on the lunch list " + member_name +"!") else: message_send('Name not recognized, use !names if you forgot your assigned name!') elif "!botdinner" in input_filtered: # Again, removing bot meal call to retain users name potential_name = input_filtered[len("!botdinner"):] if potential_name in member_list: match_index = [i for i, s in enumerate(member_list) if potential_name in s] member_name = unadjusted_member_list[match_index[0]+1] if member_name not in dinner_list: dinner_list.append(member_name) dinner_output_table.add_row([[str(member_name)]]) clear() print(text.Text("LATE PLATE BOT", color='0000ff', shadow=True, skew=5)) print(lunch_output_table.draw()) print(dinner_output_table.draw()) message_send('Gotcha ' + member_name + ' you are on the dinner list!') else: message_send("You're already on the dinner list " + member_name +"!") else: message_send('Name not recognized, use !names if you forgot your assigned name!') else: message_send("That's not a command, use !help if you don't remember the commands!")
def print_banner(): os.system('clear') try: print(text.Text("NeTQCBot", color='green', shadow=True, skew=3)) except: print('NeTQCBot') print('\t\t\t\t\t\tby PatillaCode')
def display_random_key(self, key): try: if 'win32' in sys.platform or 'win64' in sys.platform: os.system('cls') else: os.system('clear') r = lambda: random.randint(0, 255) hex = '#%02X%02X%02X' % (r(), r(), r()) print(text.Text('Press: ' + key, color=hex, shadow=True, skew=5)) except KeyboardInterrupt: clear_scr() print( text.Text('Goodbye!', color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) exit()
def end_screen(self): try: print( text.Text('Game Over', color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) print( text.Text('Points: ' + str(self.score), color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) sleep(3) # clear_scr() # name_of = [] # count = 0 # while True: # if count == 2: # break # print(text.Text('Enter Name:')) # print(text.Text(''.join(name_of))) # key = wait_key() # if key == '' or key == ' ': # count += 1 # clear_scr() # else: # name_of.append(key) # clear_scr() clear_scr() print( text.Text('Play Again? Y/N', color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) while True: key = wait_key() if key.lower() == 'y': return True elif key.lower() == 'n': return False else: pass except KeyboardInterrupt: clear_scr() print( text.Text('Goodbye!', color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) exit()
def print_banner(self): BANNER_WIDTH = 115 print("*" * BANNER_WIDTH) print(text.Text("Autolycus", color="#EF9C70", shadow=True, skew=3)) print("*" * BANNER_WIDTH) print("Author: Michael Van Leeuwen".center(BANNER_WIDTH, " ")) print("github.com/MJVL/Autolycus".center(BANNER_WIDTH, " ")) print("*" * BANNER_WIDTH)
def start_screen(self): clear_scr() r = lambda: random.randint(0, 255) hex = '#%02X%02X%02X' % (r(), r(), r()) print(text.Text('Press S to Start', color=hex, shadow=True, skew=5)) while True: if wait_key() == 's': break else: pass
def demo_text(): section('Fabulous Text Rendering') imp = " from fabulous import text\n " # print bold(imp + 'print text.Text("Fabulous")\n') # print text.Text("Fabulous") # wait() print bold(imp + 'print text.Text("Fabulous", shadow=True, skew=5)\n') print text.Text("Fabulous", shadow=True, skew=5) wait()
def end_connection(): sock.close() print(bold(white("\n\nConnection closed!!!"))) print( text.Text(" END", color='#288D28', shadow=False, skew=1, fsize=10)) f.write( "\n\n ------------------------------------------------------------------------------\n" ) f.write("\n\nConnection Closed\n") f.write("Total Messages : " + str(counter) + "\n") f.write("Date and Iime : " + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + "\n\n") f.close()
def display_menu(self): try: if 'win32' in sys.platform or 'win64' in sys.platform: os.system('cls') else: os.system('clear') r = lambda: random.randint(0, 255) hex = '#%02X%02X%02X' % (r(), r(), r()) print(text.Text('Quiik!', color=hex, shadow=True, skew=5)) sleep(3) if 'win32' in sys.platform or 'win64' in sys.platform: os.system('cls') else: os.system('clear') print(text.Text('Created by', color=hex, shadow=True, skew=5)) print(text.Text('Max Bridgland', color=hex, shadow=True, skew=5)) sleep(3) if 'win32' in sys.platform or 'win64' in sys.platform: os.system('cls') else: os.system('clear') print(text.Text('Answer In', color=hex, shadow=True, skew=5)) print(text.Text('1 Second', color=hex, shadow=True, skew=5)) sleep(3) if 'win32' in sys.platform or 'win64' in sys.platform: os.system('cls') else: os.system('clear') print(text.Text('Times Up?', color=hex, shadow=True, skew=5)) print(text.Text('You\'re Out!', color=hex, shadow=True, skew=5)) sleep(3) except KeyboardInterrupt: clear_scr() print( text.Text('Goodbye!', color='#%02X%02X%02X' % (255, 50, 50), shadow=True)) exit()
def waiting_for_connection(): print("\n\n") print( text.Text(" VIA Protocol", color='#288D28', shadow=False, skew=1, fsize=10)) print(bold(white("SENDER'S PLATFORM \n"))) print( bold( white( "Check logs in Sender-log.txt when the communication has ended\n" ))) print(bold(white("Type ':exit' to end the communication\n"))) print(bold(white("Waiting to connect"))) global connection animation = "|/-\\" idx = 0 while not connection: print(animation[idx % len(animation)], end="\r") idx += 1 time.sleep(0.1)
def main(argv): if argv == '-h' or argv == '--help': print(text.Text("ady", color='#0099ff', shadow=True, skew=5)) print("ady -- Bakı -> Sumqayıt -> Bakı hərəkət cədvəli") print("ady ['-b', '--baku', '--bakı'] -- bakı üçün hərəkət cədvəli") print( "ady ['-s', '--sum', '--sumgait', '--sumqayıt'] -- sumqayıt üçün hərəkət cədvəli" ) print( "ady ['-a', '--all', '--ha', '--hamısı'] -- hər iki hərəkət cədvəli" ) else: getTable() if argv == "-b" or argv == "--baku" or argv == "--bakı": print(format_pretty_table(baku_table, baku_header)) sys.exit() elif argv == "-s" or argv == "--sum" or argv == "--sumgait" or argv == "--sumqayıt": print(format_pretty_table(sum_table, sum_header)) sys.exit() elif argv == "-a" or argv == "--all" or argv == "--ha" or argv == "--hamısı": print(format_pretty_table(baku_table, baku_header)) print(format_pretty_table(sum_table, sum_header)) sys.exit()
dinner_list = [] initialize = 0 last_message_id = '' # Table creation and initialization lunch_output_table = Texttable() dinner_output_table = Texttable() # Extra spaces to allow for large names to not be on multiple lines dinner_output_table.add_row([[' Dinner ']]) lunch_output_table.add_row([[' Lunch ']]) lunch_output_table.set_cols_align("c") dinner_output_table.set_cols_align("c") # Print Banner print(text.Text("LATE PLATE BOT", color='0000ff', shadow=True, skew=5)) print(lunch_output_table.draw()) print(dinner_output_table.draw()) # Used to make sure fake names are not put onto the lists. unadjusted_member_list = open(member_path, "r").read().splitlines() member_list = [ entry.replace(" ", "").lower() for entry in unadjusted_member_list[1:] ] # List subdivision to avoid extremely long lists sent to chat PC15_names = unadjusted_member_list[1:24] PC16_names = unadjusted_member_list[25:46] PC17_names = unadjusted_member_list[47:69] PC18_names = unadjusted_member_list[70:]
# pip install fabulous from fabulous import text, image print(text.Text('Super', color='#ffffff', shadow=True, skew=6)) print(image.Image('other/qr.png')) # pip install art import art print(art.randart()) art.tprint("Super", "mix") print(art.text2art("Super", font='block'))