import tkinter as tkfrom tkinter import filedialogdef convert_file(): input_path = input_entry.get() output_path = output_entry.get() with open(input_path, 'r') as f: binary_str = f.readline().strip() symbol_str = binary_str.replace('0', '¦').replace('1', '▕') with open(output_path, 'w') as f: f.write(symbol_str) result_label.config(text="Conversion complete!")root = tk.Tk()root.title("Binary to Symbol Converter")input_frame = tk.Frame(root)input_frame.pack(pady=10)input_label = tk.Label(input_frame, text="Input File Path:")input_label.pack(side=tk.LEFT)input_entry = tk.Entry(input_frame, width=50)input_entry.pack(side=tk.LEFT, padx=5)output_frame = tk.Frame(root)output_frame.pack(pady=10)output_label = tk.Label(output_frame, text="Output File Path:")output_label.pack(side=tk.LEFT)output_entry = tk.Entry(output_frame, width=50)output_entry.pack(side=tk.LEFT, padx=5)button_frame = tk.Frame(root)button_frame.pack(pady=10)convert_button = tk.Button(button_frame, text="Convert File", command=convert_file)convert_button.pack()result_label = tk.Label(root, text="")result_label.pack()root.mainloop()
|