0xa701d95b…3bf5sent to0xa701d95b…3bf5·#18,601,486·view on Etherscan
import tkinter as tk
def convert_to_hex(event=None):
input_text = input_entry.get()
try:
hex_value = bytes(input_text, 'UTF-8').hex()
result_label.config(text=f'Hex Code: {hex_value}')
root.clipboard_clear()
root.clipboard_append(hex_value)
root.update()
result_label.config(text='Done')
except Exception as e:
result_label.config(text='Error')
root = tk.Tk()
root.title('Converter')
if root.geometry(''):
window_width, window_height = map(int, root.geometry().split('x'))
else:
window_width, window_height = 200, 100
root.geometry(f'{window_width}x{window_height}')
input_label = tk.Label(root, text='Input')
input_label.pack()
input_entry = tk.Entry(root)
input_entry.pack()
convert_button = tk.Button(root, text='✅', command=convert_to_hex)
convert_button.pack()
result_label = tk.Label(root, text='')
result_label.pack()
root.bind('<Return>', convert_to_hex)
root.mainloop()