def test_render_background(): assert render("text", background="red", size=(50, 10)) == ( "\x1b[41m{0}\n{0}\n" " ████████╗ ███████╗ ██╗ ██╗ ████████╗ {1}\n" " ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ {1}\n" " ██║ █████╗ ╚███╔╝ ██║ {1}\n" " ██║ ██╔══╝ ██╔██╗ ██║ {1}\n" " ██║ ███████╗ ██╔╝ ██╗ ██║ {1}\n" " ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ {1}\n{0}\n{0}\x1b[49m").format( " " * 50, " " * 11)
def test_render_ignore_non_supported(): assert render("te*xt", size=(100, 10)) == ("\n\n" " ████████╗ ███████╗ ██╗ ██╗ ████████╗ \n" " ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ \n" " ██║ █████╗ ╚███╔╝ ██║ \n" " ██║ ██╔══╝ ██╔██╗ ██║ \n" " ██║ ███████╗ ██╔╝ ██╗ ██║ \n" " ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ \n\n")
def remotegetblock(): try: clear() closed() if os.path.isfile('pyblocksettingsClock.conf') or os.path.isfile( 'pyblocksettingsClock.conf' ): # Check if the file 'bclock.conf' is in the same folder settingsv = pickle.load(open("pyblocksettingsClock.conf", "rb")) # Load the file 'bclock.conf' settingsClock = settingsv # Copy the variable pathv to 'path' else: settingsClock = { "gradient": "", "design": "block", "colorA": "green", "colorB": "yellow" } pickle.dump(settingsClock, open("pyblocksettingsClock.conf", "wb")) b = rpc('getblockcount') c = str(b) a = c output = render( str(c), colors=[settingsClock['colorA'], settingsClock['colorB']], align='center') print("\x1b[?25l" + output) while True: x = a b = rpc('getblockcount') c = str(b) if c > a: clear() closed() output = render( str(c), colors=[settingsClock['colorA'], settingsClock['colorB']], align='center') print("\a\x1b[?25l" + output) a = c except: pass
def format_help_text(self, ctx, formatter): from cfonts import render formatter.write( render( "PDM", font="slick", gradient=["bright_red", "bright_green"], space=False, )) formatter.write_paragraph() formatter.write_text(self.help) formatter.write_paragraph()
def design(): while True: if os.path.isfile('pyblocksettingsClock.conf') or os.path.isfile('pyblocksettingsClock.conf'): # Check if the file 'bclock.conf' is in the same folder settingsv = pickle.load(open("pyblocksettingsClock.conf", "rb")) # Load the file 'bclock.conf' settingsClock = settingsv # Copy the variable pathv to 'path' else: settingsClock = {"gradient":"", "design":"block", "colorA":"green", "colorB":"yellow"} pickle.dump(settingsClock, open("pyblocksettingsClock.conf", "wb")) bitcoinclient = path['bitcoincli'] + " getblockcount" block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string b = block a = b blogo() output = render(str(b), colors=[settingsClock['colorA'], settingsClock['colorB']], align='center') print("\x1b[?25l" + output) bitcoinclient = path['bitcoincli'] + " getbestblockhash" bb = os.popen(str(bitcoinclient)).read() ll = bb bitcoinclientgetblock = path['bitcoincli'] + " getblock " + ll qq = os.popen(bitcoinclientgetblock).read() yy = json.loads(qq) mm = yy outputsize = render(str(mm['size']) + " bytes", colors=[settingsClock['colorA'], settingsClock['colorB']], align='center', font='tiny') print("\x1b[?25l" + outputsize) outputtxs = render(str(mm['nTx']) + " txs", colors=[settingsClock['colorA'], settingsClock['colorB']], align='center', font='tiny') print("\x1b[?25l" + outputtxs) while True: x = a bitcoinclient = path['bitcoincli'] + " getblockcount" block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string b = block if b > a: clear() blogo() output = render(str(b), colors=[settingsClock['colorA'], settingsClock['colorB']], align='center') print("\a\x1b[?25l" + output) bitcoinclient = path['bitcoincli'] + " getbestblockhash" bb = os.popen(str(bitcoinclient)).read() ll = bb bitcoinclientgetblock = path['bitcoincli'] + " getblock " + ll qq = os.popen(bitcoinclientgetblock).read() yy = json.loads(qq) mm = yy outputsize = render(str(mm['size']) + " bytes", colors=[settingsClock['colorA'], settingsClock['colorB']], align='center', font='tiny') print("\x1b[?25l" + outputsize) outputtxs = render(str(mm['nTx']) + " txs", colors=[settingsClock['colorA'], settingsClock['colorB']], align='center', font='tiny') print("\x1b[?25l" + outputtxs) t.sleep(10) clear() blogo() a = b output = render(str(b), colors=[settingsClock['colorA'], settingsClock['colorB']], align='center') print("\x1b[?25l" + output)
def test_render_add_line_break(): assert render("te|xt", size=(100, 10)) == ("\n\n" " ████████╗ ███████╗ \n" " ╚══██╔══╝ ██╔════╝ \n" " ██║ █████╗ \n" " ██║ ██╔══╝ \n" " ██║ ███████╗ \n" " ╚═╝ ╚══════╝ \n\n" " ██╗ ██╗ ████████╗ \n" " ╚██╗██╔╝ ╚══██╔══╝ \n" " ╚███╔╝ ██║ \n" " ██╔██╗ ██║ \n" " ██╔╝ ██╗ ██║ \n" " ╚═╝ ╚═╝ ╚═╝ \n\n")
def test_render_break_new_line(): assert render("text", size=(20, 10)) == ("\n\n" " ████████╗ ███████╗ \n" " ╚══██╔══╝ ██╔════╝ \n" " ██║ █████╗ \n" " ██║ ██╔══╝ \n" " ██║ ███████╗ \n" " ╚═╝ ╚══════╝ \n\n" " ██╗ ██╗ ████████╗ \n" " ╚██╗██╔╝ ╚══██╔══╝ \n" " ╚███╔╝ ██║ \n" " ██╔██╗ ██║ \n" " ██╔╝ ██╗ ██║ \n" " ╚═╝ ╚═╝ ╚═╝ \n\n")
def format_help(self) -> str: formatter = self._get_formatter() if getattr(self, "is_root", False): banner = ( cfonts.render( "PDM", font="slick", gradient=["bright_red", "bright_green"], space=False, ) + "\n" ) formatter._add_item(lambda x: x, [banner]) self._positionals.title = "Commands" self._optionals.title = "Options" # description formatter.add_text(self.description) # usage formatter.add_usage( self.usage, self._actions, self._mutually_exclusive_groups, prefix=termui.yellow("Usage", bold=True) + ": ", ) # positionals, optionals and user-defined groups for action_group in self._action_groups: formatter.start_section( termui.yellow(action_group.title, bold=True) if action_group.title else None ) formatter.add_text(action_group.description) formatter.add_arguments(action_group._group_actions) formatter.end_section() # epilog formatter.add_text(self.epilog) # determine help from format above return formatter.format_help()
def inp(text, *args, font='console', size=(150, 32), colors=['blue'], background='transparent', align='left', line_height=1, space=False): for i in args: text.append(i) inps = cfonts.render(text, font=font, align=align, size=size, colors=colors, max_length=0, line_height=line_height, space=space, background=background) return input(inps)
def run(): try: output = render('RUST', colors=['red', 'yellow'], align='center', line_height=0) print(output) say("Bootloader", align='center', colors=['red', 'cyan', 'green'], font='chrome', line_height=0) say("Configure Cortex-M Series Microcontroller", align='left', colors=['yellow'], font='console', line_height=0) host = input("Enter IP Address : ") port = input("Enter Port Address: ") filebin = input("Enter Application bin file path: ") display_text_init = "Connecting to Microcontroller " + host + ":" + port print(display_text_init, end=" ") for _ in range(4): print(".", end="") time.sleep(1) print("") print("Connected") print("Flashing Started .................") bindata = open(filebin, "rb").read() write_file(host, int(port), 256, 0x08080000, bindata) except OSError as e: print("Operation done.") except BootloaderError as e: print("Bootloader error:", e) except MismatchError as e: print("Mismatch error:", e)
def select_choice(self): try: choice_msg = self.s.recv(1024) list = str(choice_msg.decode()).split(":") self.logger = MSSLogger.getClientLogger("Client" + list[1]) self.clientThreadCount = list[1] width = os.get_terminal_size().columns output = render('Welcome To MSS', font='simple', colors=['red', 'yellow'], align='center', size=(150, width), line_height=0) print(output, list[0]) self.logger.info(output + list[0]) # User will provide the input as he wants to use the service choice_in = input( "Please choose the functionality you want to proceed with: ") self.logger.info( "Please choose the functionality you want to proceed with: " + choice_in) self.s.send((list[1] + ":" + choice_in).encode()) choice_rec = self.s.recv( 1024) # According to selected choice, look for the service self.logger.info(choice_rec.decode()) time.sleep(2) os.system("cls") self.select_choice_part(choice_rec) except KeyboardInterrupt: print("Closing the socket as interrupted by user") sys.exit(1) except socket.error as msg: # IN case connection timed out and socket creation is failed. print("Socket Creation error: " + str(msg)) sys.exit(1)
def print_jobs(subreddit): output = render(subreddit, colors=["red", "yellow"], align="center", line_height=1) print(output) for_hire = reddit.subreddit(subreddit) for submission in for_hire.new(limit=2): if submission.id in posts_read: continue else: posts_read.append(submission.id) if (submission.link_flair_css_class == "fh-hiring" or submission.link_flair_css_class == "fh-stillhiring" or submission.link_flair_css_class == "task"): print( f"{bcolors.WARNING}Title:\t{submission.title}{bcolors.ENDC}" ) print(f"Time:\t{unix_to_local(submission.created_utc)}") print(f"{bcolors.HEADER}Url:\t{submission.url}{bcolors.ENDC}") print(f"Text:\n{submission.selftext}") print("---------------------------------\n")
def animate(): word="RAILWAY MGMT SYS" for i in range(1,len(word)+1): print(render(word[0:i], colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('cls')
class smb: WARN = fontcolor.red(" [-] ") DONE = fontcolor.green(" [+] ") INPUT = fontcolor.cyan(" [»] ") ONE = fontcolor.cyan(" [1] ") TWO = fontcolor.cyan(" [2] ") THREE = fontcolor.cyan(" [3] ") FOUR = fontcolor.cyan(" [4] ") FIVE = fontcolor.cyan(" [5] ") #banner art banner = render("youtube thumbnail downloader", font='chrome', colors=["green", "green", "green"], align='center') print(banner) #instructions menu print(smb.DONE + fontcolor.green("USAGE INSTRUCTIONS :")) print(smb.ONE + fontcolor.white("Paste YouTube Video Link")) print(smb.TWO + fontcolor.white("Select Desired Resolution")) #getting youtube link yt_link = None while not yt_link: yt_link = input("\n" + smb.INPUT + fontcolor.white("Paste YouTube Video Link : ")) #validating link using oembed API
if sample.endswith('.mrxs'): mrxs+=1 elif os.path.isdir(input_dir + '/' + sample): fold+=1 if mrxs!=fold: #The input folder must has MIRAX format files (.mrxs+.data) print('ERROR! There is a problem in the MIRAX files in the input folder.\nThe input folder should contains ' 'files with the extension .mrxs and the same number of foders with the .dat files') quit() return input_dir,output_dir if __name__ == '__main__': #Program title Title = cfonts.render('HistoCrop', colors=['bright_white', 'white']) print(Title) #Selection of the two possible funciton: ROI crop, Spot crop + Help instructions select_def=str(input('Press R in case you want to crop a ROI from a WSIs\nPress S in case you want to crop the ' 'Spots present in the TMAs\nPress H in case you want to read the instructions: ' ).upper()) #ROI crop selection if select_def=='R': print('ROI crop selected') (input_dir,output_dir)=in_out() #ROI class call Crop(input_dir, output_dir).ROI() #Spot crop selection
YELLOW = '\x1b[1;33;40m' BLUE = '\x1b[1;34;40m' PURPLE = '\x1b[1;35;40m' CYAN = '\x1b[1;36;40m' WHITE = '\x1b[1;37;40m' END = '\x1b[0m' #banner def banner(): banner = render("covid", colors=['yellow', 'cyan'], align='center') print(banner) banner2 = render("THANK-YOU", font='chrome', colors=['green', 'green', 'green'], align='center') #display time author def time_author(): tem = arrow.get().format('DD-MM-YYYY') print(YELLOW + ' [*] ' + END + YELLOW + tem + END, '-' * 30, YELLOW + '$ Sumit $' + END) #print banner & time/author banner() time_author() #symbol used in program
def banner(): banner = render("covid", colors=['yellow', 'cyan'], align='center') print(banner)
from hotkey import hotKey from app import App import keyboard import time from cfonts import render # App Name :) output = render('Voice Keybinder', align='center') print(output) try: # hotkey for making the application listen to user print( 'Select your hotkey to start listening to you. Beware it should not match any other shortcut of your editor.' ) print( 'You can choose to use the default hotkey \'ctrl+shift+windows\' by pressing \'ctrl+alt\' now:' ) start_key_com = keyboard.read_hotkey() if start_key_com == 'ctrl+alt' or start_key_com == 'ctrl+shift+alt': start_key_com = 'ctrl+shift+windows' print('Hotkey selected for starting: ' + start_key_com) # # time to speak command # speak_time = int(input('Enter time in seconds you need to speak commands (maximum 2.5 seconds): ')) # speak_time = speak_time if speak_time <= 2.5 else 2.5 # print('Time to speak each command: {} seconds'.format(speak_time)) # creating new app instance app = App()
# MVP: Get User input and have a pre determined story print out from cfonts import render, say import time output = render('Welcome', colors=['blue', 'blue'], align='center') print(output) time.sleep(1) output = render('To The', colors=['red', 'red'], align='center') print(output) time.sleep(1) output = render('Story', colors=['white', 'white'], align='center') print(output) time.sleep(2) # Story starts here ---------------------- def option_check(option): updated = option while True: valid_values = ["saiyan", "mage", "human", "hero", "villian"] if updated.lower() in valid_values: break else: updated = input("Sorry we didn't catch that: ").lower() return updated
def cli(): """ Uber for the command line. """ echo(render("Ride.", colors=['blue', 'white'], align='center'))
def animate(): print(render("R", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RA", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAI", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAIL", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILW", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWA", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY", colors=['red', 'yellow'], align='center')) os.system('clear') print(render("RAILWAY M", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MG", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MGM", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MGMT", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MGMT S", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MGMT SY", colors=['red', 'yellow'], align='center')) time.sleep(0.2) os.system('clear') print(render("RAILWAY MGMT SYS", colors=['red', 'yellow'], align='center'))
# -*- coding: utf-8 -*- """ Created on Sat Oct 3 00:54:38 2020 @author: Anonno """ from cfonts import render text = render('Anonno Singha Ray', gradient=['red', 'blue']) print(text)
Here are some rules to play: In each round you will be given an famous person's or character's name; You will then have to come up with a makeshift QUOTE from this person or character; Each player will provide their own answer in secret; Then, you all get a poll containing your QUOTEs and one true QUOTE and each player will try to guess the correct one; Here is how points will work: a) You get 20 points if your personal QUOTE matches the one in store word by word; b) 7 points if you choose right in the pool; c) 5 points for each time another player chooses your QUOTE from the pool; The winner is the player with most points in the end! Feeling Lucky?! """ print(render(title)) print(title_message) ##2 input the number of players and player names def number_of_players(): players = input("Please insert the number of players [2-8]") while True: if players in create_num_list(2, 8): break elif players == "": players = "2" break players = input("Please insert the number of players [2-8]") return players
print('DOWNLOAD COMPLETE !!!'+"\n"+"File in default path") except Exception as e: print(f"failure due to:\t{e}") helf=input('Would you lie suggestions??\t y/n\t') if helf=='y': print("\t\t\t\t\t\tTry selecting other video resolutions\n\t\t\t\t\tCheck the path of the destination ") else: #if you do not have package and want to install if pacins=='y' and pac=='n': for i in ['pytube3','pdm','colorama']: install(i) #if you do have package from pytube import YouTube from colorama import Fore, Back, Style,init from cfonts import render, say output1 = render('YouTube', colors=['red', 'white'], align='center',size=[158,48],line_height=1) output2 = render('Downloader', colors=['red', 'white'], align='center',size=[158,48],line_height=1) compl = render('Download sucessful', colors=['green', 'yellow'], align='center',size=[168,50],line_height=1) failed = render('Download Failed', colors=['green', 'white'], align='center',size=[158,48],line_height=2) sad = render(':(', colors=['cyan'], align='center',size=[158,50],line_height=1) def prompt1(sel1): while sel1 not in range (0,len(form)): print(Fore.RED+"Enter valid index!!!!!\t"+Fore.RESET) sel1=eval(input(f"enter the video format index:")) return sel1 print(output1+"\n"+output2) init() yt=YouTube(input(f"Enter the URL ::\t")) print(f"Conforming the video title:{yt.title}") print(f"the foloowing ideo fromats are available: ")
from send_mail import send_mail from cfonts import render import getpass output = render('SREEHARI', colors=['red', 'green'], align='center') print(output) count = int(input("How many mails do you want to send : ")) # Login details email = input("\nEnter your email id : ") print( '''\nNote: You cannot use your orginal gmail password you have to go to https://myaccount.google.com/apppasswords and generate app password for mail.''') password = getpass.getpass("\n\nEnter your password : "******"\nTo whom do you want to sent mail : ") subject = input("\nEnter the subject : ") message = input('\nEnter the message : ') for x in range(count): r = send_mail(email, password, to_email, subject, message) if r == 'Sending Failed':
zipfiles.extend([x for x in os.listdir(os.getcwd()) if x.endswith(".zipx")]) zipfiles.extend([x for x in os.listdir(os.getcwd()) if x.endswith(".7z")]) zipfiles.extend([x for x in os.listdir(os.getcwd()) if x.endswith(".rar")]) bk = "\\" dest = "C:\\Users\\Admin\\Desktop\\pythoonnn\\bub" desty = "C:\\Users\\Admin\\Desktop\\flask files" destextfiles = "C:\\Users\\Admin\\Desktop\\Text files" destcpp = "C:\\Users\\Admin\\Desktop\\cppfiles" imgfilepath = "C:\\Users\\Admin\\Desktop\\images" pdfilepath = "C:\\Users\\Admin\\Desktop\\pdf files" ttfilepath = "C:\\Users\\Admin\\Desktop\\ttffiles" javafilepath = "C:\\Users\\Admin\\Desktop\\javafiles" mp3filepath = "C:\\Users\\Admin\\Desktop\\songsss" wordsfilepath = "C:\\Users\\Admin\\Desktop\\Word documents" zipfilespath = "C:\\Users\\Admin\\Desktop\\Zipfiles" output = render('Welcome back,Abhishek', colors=['red', 'blue'], align='center', font='chrome') print(output) countj, countcpp, counttxt, counttpdf, counttimg, countpy, countt, countmus, countword, countzips = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 # Pythonn files for x in lst: name = x if name.startswith('flask'): countpy += 1 shutil.move(os.getcwd() + bk[0] + name, desty) print("Flask related file detected and moved to seperate flask folder.") else: fcheckexist = Path(dest + bk[0] + name) if(fcheckexist.is_file()): os.remove(os.getcwd() + bk[0] + name) else: countpy += 1
def generateTitle(): output = render('News Recover', colors=['red', 'yellow'], align='center') print(output)
def test_render_console_with_color(): text = render("text", font="console", colors=["red"], size=(100, 10)) assert text == "\n\n\x1b[31mtext\x1b[39m\n\n"
def test_render_console(): text = render("text", font="console", size=(100, 10)) assert text == "\n\ntext\n\n"
#Install-selenium #Download-FireFox-WebDriver from selenium import webdriver from time import sleep import time import cfonts import colorama colorama.init() print(cfonts.render("Instgram Spammer", colors=["red", "yellow"])) print(colorama.Fore.GREEN + ''' 🔒 - Use at your own risk, we are not responsible for your actions. ☑️ - Made by Hesamzs and Mazdak Pakaghideh. 📝 - Notes: follow the instructions below . ''' + colorama.Fore.RESET) print(colorama.Fore.GREEN + ''' ======= 📝 - Instructions: -------------------------------------------------------- |1-) Type the Instagram account username | | | |2-) Type the Instagram account password | | | |3-) Enter the name of user or group | | | |4-) Delay beatwean each message | | | |5-) Message body | | |