Skip to content

Commit b8502f6

Browse files
committed
Add loading bar
1 parent 50aaa07 commit b8502f6

File tree

2 files changed

+72
-3
lines changed

2 files changed

+72
-3
lines changed

Image-Dict/convert.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
resolution = int(input("Set your res (default is 2): ")) # Ask the user for the res
1111

1212
if os.path.exists("output.py"): # If an existing file exists
13-
os.remove("output.py") # Remove it
13+
try:
14+
os.remove("output.py") # Remove it
15+
except:
16+
"Unable to remove file!"
1417
else: # Otheriwise
15-
print("Creating empty file") # We're good!
18+
print("Creating empty file") # We're good!
1619

1720
list_of_colors = [[0,0,0],[0,0,255],[150,75,0],[0,255,255],[255,215,0],[128,128,128],[0,255,0],[75,0,130],[255,165,0],[251,96,127],[160,32,240],[255,0,0],[143,0,255],[255,255,255],[250,255,0]]
1821
list_of_names = ["black", "blue", "brown", "cyan", "gold", "gray", "green", "indigo", "orange", "pink", "purple", "red", "violet", "white", "yellow"]
@@ -44,7 +47,7 @@ def closest(colors,color):
4447
output_color = list_of_names[index_in_array]
4548
index_in_array = index_in_array + 1
4649

47-
print(output_color)
50+
print("Current Color: " + str(output_color) + ", Current line: " + str(row) + "/" + str(height) + " ", end="\r")
4851
if(output_color != "white"):
4952
output_file.write("\"" + str(column) + " " + str(row) + " " + output_color + "\", ")
5053
output_file.write("""]

Image-Dict/output.py

+66
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)