Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- def divide():
- try:
- divider1 = float(divider1_entry.get())
- divider2 = float(divider2_entry.get())
- if divider2 !=0:
- result = divider1 / divider2
- result_label.config(text=str(result))
- except Exception as e:
- print(e)
- root = tk.Tk()
- root.title('Διαίρεση σε παραθυρικό περιβάλον')
- root.geometry('200x200')
- divider1_label = tk.Label(text='Διερεταίος')
- divider1_label.pack()
- divider1_entry = tk.Entry(root, justify=tk.CENTER)
- divider1_entry.pack()
- divider2_label = tk.Label(text='Διερέτης', justify='center')
- divider2_label.pack(pady=10)
- divider2_entry = tk.Entry(root, justify=tk.CENTER)
- divider2_entry.pack()
- divide_button = tk.Button(text='Εκτέλεση', justify='center', command=divide)
- divide_button.pack(pady=20)
- result_label = tk.Label(text='Πυλίκο', justify='center')
- result_label.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement