Skip to content

Commit

Permalink
Update gui_gui.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Thinkseal authored Oct 27, 2024
1 parent 383492b commit 7ac7ed4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions versions/gui_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@
from library.TextConverter import TextConverter
converter = TextConverter()

def copy_to_clipboard(text):
pyperclip.copy(text.get())
def FlipedTextCopy(text):
pyperclip.copy(converter.reverse_text(converter.text_flip(text.get())))

def add_text(text_input):
ttk.Label( text=converter.reverse_text(text_input.get())).grid(row=2,column=2)
ttk.Label( text=converter.text_flip(text_input.get())).grid(row=4,column=2)
ttk.Label( text=converter.enchant_text(text_input.get())).grid(row=5,column=2)
ttk.Label( text=converter.reverse_text(text_input.get()),justify="left").grid(sticky = W,row=2,column=2)
ttk.Label( text=converter.text_flip(text_input.get()),justify="left").grid(sticky = W,row=4,column=2)
ttk.Label( text=converter.enchant_text(text_input.get()),justify="left").grid(sticky = W,row=5,column=2)

def add_copy_buttons():
ttk.Button(root, text="copy", command=partial(copy_to_clipboard, translate_text),).grid(row=2, column=1)
ttk.Button(root, command=partial(FlipedTextCopy, translate_text), image = copy_icon).grid(row=2, column=1)

root = Tk()
root.title("Translator")
ico = Image.open('images/icon.ico')
photo = ImageTk.PhotoImage(ico)
root.wm_iconphoto(False, photo)
root.geometry("600x300")
copy_icon = Image.open('images/content_copy.png')
copy_icon = ImageTk.PhotoImage(copy_icon)

ttk.Label( text="Enter text to translate:").grid(column=0, row=0)
translate_text = Entry(root)
Expand Down

0 comments on commit 7ac7ed4

Please sign in to comment.