Bin Reader
A Python code snippet for an app that decodes binary files.user_8806294
actionscript
3 years ago
768 B
9
Indexable
import tkinter as tk
from tkinter import filedialog
import pyperclip
def upload_file():
filepath = filedialog.askopenfilename()
with open(filepath, "rb") as f:
data = f.read()
unicode_art = data.decode('utf-8', 'ignore')
textbox.delete("1.0", tk.END) # clear the textbox before inserting new data
textbox.insert(tk.END, unicode_art)
def copy_to_clipboard():
selected_text = textbox.get("1.0", tk.END)
pyperclip.copy(selected_text)
root = tk.Tk()
root.title("Unicode Art from BIN file")
upload_button = tk.Button(text="Upload BIN file", command=upload_file)
upload_button.pack()
copy_button = tk.Button(text="Copy to clipboard", command=copy_to_clipboard)
copy_button.pack()
textbox = tk.Text()
textbox.pack()
root.mainloop()
Editor is loading...