-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext_copier_gui.py
38 lines (29 loc) · 1.18 KB
/
text_copier_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import tkinter as tk
def copy_text_and_write_note(button_name):
text = text_area1.get("1.0", "end-1c")
text_area2.delete(1.0, tk.END)
text_area2.insert(tk.END, text + f"\n\nButton '{button_name}' is clicked.")
def main():
# Create the main window
root = tk.Tk()
root.title("Text Copier")
# Create and place labels
label_a = tk.Label(root, text="Person A")
label_a.grid(row=0, column=0, padx=5, pady=5)
label_b = tk.Label(root, text="Person B")
label_b.grid(row=0, column=2, padx=5, pady=5)
# Create and place text areas
global text_area1, text_area2
text_area1 = tk.Text(root, height=10, width=40)
text_area1.grid(row=1, column=0, padx=5, pady=5)
text_area2 = tk.Text(root, height=10, width=40)
text_area2.grid(row=1, column=2, padx=5, pady=5)
# Create and place buttons
buttons = ["RSA", "Diffie Helman", "El-Gamal"]
for i, button_name in enumerate(buttons):
button = tk.Button(root, text=button_name, command=lambda name=button_name: copy_text_and_write_note(name))
button.grid(row=i+2, column=1, padx=5, pady=5)
# Run the main event loop
root.mainloop()
if __name__ == "__main__":
main()