Added the Art collection

Added this collection to convert 'getblockcount' result into an ASCII design.
This commit is contained in:
curly60e 2020-05-08 08:37:26 -03:00 committed by GitHub
parent e38734dfcd
commit 252ab1a46f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,32 +1,44 @@
import os
import time as t
from art import *
def getblock(): #get access to bitcoin-cli with the command getblockchaininfo
def getblock(): # get access to bitcoin-cli with the command getblockchaininfo
bitcoincli = " getblockchaininfo"
os.system(path + bitcoincli)
def getblockcount(): #get access to bitcoin-cli with the command getblockcount
def getblockcount(): # get access to bitcoin-cli with the command getblockcount
bitcoincli = " getblockcount"
os.system(path + bitcoincli)
def clear(): #clear the screen
def clear(): # clear the screen
os.system('cls' if os.name=='nt' else 'clear')
clear()
print("Welcome to the Python Block Clock\n\n")
path = input("Insert the Path to Bitcoin-Cli: ") #path to the bitcoin-cli
a = input("Do you want to see just Block height? 'Yes', for just Block Height. 'No', for full blockchain data. Y/n: ") #select if block height or just fullblockchain information
tprint("BlockClock", font="rnd-large")
print("Welcome to Python BlockClock\n\n")
path = input("Insert the Path to Bitcoin-Cli: ") # path to the bitcoin-cli
a = input("Do you want to see just Block height? 'Yes', for just Block Height. 'No', for full blockchain data. Y/n: ") # select if block height or just ful\
lblockchain information
custom = input("Do you want random designs? Y/n: ")
while True: #Loop
clear() #call clear function that clears the screen
while True: # Loop
clear() # call clear function that clears the screen
bitcoinclient = path + " getblockcount"
block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string
b = block # copy the result in the variable 'b'
if a == "y" or a == "Y":
getblockcount()
if custom == "y" or custom == "Y":
tprint(b, font="rnd-large") # use the art collection and print the result in a nice ASCII result
else:
getblockcount()
else:
getblock()
t.sleep(3) # pause the loop for 3 seconds
t.sleep(3) #pause the loop for 3 seconds