'''
Description:
ENA PROGRAMMA,POU METATREPEI TA EKATOSTA MIAS DEXAMENHS SE LITRA,KAI TA LITRA SE EKATOSTA

Author: Errikos Ntinos
Version 1.0.0 (mazema kodika,pros8iki leptomeron sxolion gia boi8eia)
Status: VERIFIED
Python version used: 3.x

'''
# eisagogi apaitoumenon libraries
from tkinter import *
import tkinter as tk
from tkinter import ttk

'''
ermeinia oron:
window: einai i onomasia tou para8yrou,mporei na allaxei se otidipote, arkei na meinei to onoma idio pantou..
window.title: o titlos pou fainetai sto para8yro
window.geometry: oi diastaseis tou para8yrou
window.configure: allazei tin emfanisi tou para8yrou
syntetagmenes x,y (orizontia kai ka8eta antistoixa)
'''
# sxediasmos tou grafikou periballontos Tkinter - des sxolia parapano...
def main():
    window= tk.Tk()
    window.title("ΥΠΟΛΟΓΙΣΤΗΣ ΠΕΤΡΕΛΑΙΟΥ")
    window.geometry("800x800")
    window.configure(background='#F6E0DB')
   
# codeblock 1 
    # sxediase to label1 gia eisagogi ekatoston
    label1 = tk.Label(window, text="Πόσα εκατοστά έχεις; ")
    # topo8etise to label1 stis syntetagmenes x,y 
    label1.place(x=50,y=20)
    
    # sxediase ena Entry widget (textbox1) gia to label1 
    textbox1 = tk.Entry(window, width=10)
    
    # sxediase to label2 gia na emfaniseis to minima sou
    label2 = tk.Label(window, text="Εχεις διαθέσιμα Λίτρα:")
    # topo8etise to label2 stis syntetagmenes x,y
    label2.place(x=50,y=50)

    # sxediase to label3 me keno gia na typosei to apotelesma
    label3 = tk.Label(window, text=" ")
    # topo8etise to label3 stis syntetagmenes x,y
    label3.place(x=180,y=50)

    # topo8etise to textbox1 stis syntetagmenes x,y
    textbox1.place(x=200,y=20)

# orise tin function gia metatropi ekatoston se litra         
    def button1_click():
        litra = round(float(textbox1.get()) * 10)
        label3.configure(text = str(litra)+ ' Λίτρα')
        
    # sxediase to button1
    button1 = tk.Button(window, text="Εμφάνισε τα Λίτρα", command=button1_click)
    # topo8etise to button1 stis syntetagmenes x,y 
    button1.place(x=50,y=100)
# telos codeblock 1 


# codeblock 2 #
    # sxediase to label4 me keimeno posa litra paraggeiles
    label4 = tk.Label(window, text="Πόσα Λίτρα παράγγειλες; ")
    # topo8etise to label4 stis syntetagmenes x,y 
    label4.place(x=50,y=230)
    
    # sxediase to label5 me keimeno litra se ekatosta
    label5 = tk.Label(window, text="Απο Λίτρα σε εκατοστά:    ")
    # topo8etise to label5 stis syntetagmenes x,y 
    label5.place(x=50,y=260)

    # sxediase ena Entry widget (textbox2)  
    textbox2 = tk.Entry(window, width=10)
    # topo8etise to textbox2 stis syntetagmenes x,y 
    textbox2.place(x=200,y=230)
    
    # sxediase to label6 me keno,gia na typosei to apotelesma
    label6 = tk.Label(window, text="  ")
    # topo8etise to label6 stis syntetagmenes x,y 
    label6.place(x=180,y=260)

# orise tin function litra se ekatosta
    def button2_click():
        centimetre = round(float(textbox2.get()) / 10)
        label6.configure(text = str(centimetre)+ ' εκατοστά')
    # sxediase to button2
    button2 = tk.Button(window, text="Εμφάνισε τα εκατοστά", command=button2_click)
    # topo8etise to button2 stis syntetagmenes x,y 
    button2.place(x=50,y=290)
# telos codeblock 2 


# codeblock 3 
    # sxediase to label7 me keimeno posa ekatosta exei h dexameni mesa
    label7 = tk.Label(window, text="Πόσα εκατοστά εχεις ηδη; ")
    # topo8etise to label7 stis syntetagmenes x,y 
    label7.place(x=50,y=400)
    
    # sxediase to label8 me keimeno posa ekatosta 8a baleis,apo ton ypologismo pou ekanes
    label8 = tk.Label(window, text="Πόσα εκατοστά θα βάλεις; ")
    # topo8etise to label8 stis syntetagmenes x,y 
    label8.place(x=50,y=450)

    # sxediase ena Entry widget 3(textbox3)  
    textbox3 = tk.Entry(window, width=10)
    # topo8etise to textbox3 stis syntetagmenes x,y 
    textbox3.place(x=200,y=400)
    
    # sxediase ena Entry widget 4(textbox4)  
    textbox4 = tk.Entry(window, width=10)
    # topo8etise to textbox4 stis syntetagmenes x,y 
    textbox4.place(x=200,y=450)
      
    # sxediase to label9 me keno gia na typosei to apotelesma
    label9 = tk.Label(window, text=" ")
    # topo8etise to label9 stis syntetagmenes x,y 
    label9.place(x=50,y=500)

# orise tin function gia na pros8eseis ta ekatosta pou eixes kai auta pou 8a baleis
    def button3_click():
        centimetre = round(float(textbox3.get()) + float(textbox4.get()))
        label9.configure(text = 'Τελικά θα εχεις ' + str(centimetre) + ' εκατοστά')
    # sxediase to button3
    button3 = tk.Button(window, text="Εμφάνισε τα συνολικά εκατοστά", command=button3_click)
    # topo8etise to button3 stis syntetagmenes x,y 
    button3.place(x=50,y=530)
# telos codeblock 3


# codeblock 4

# orise tin function,gia exodo apo to programma
    def button4_click():
        exit_program=window.destroy()
# sxediase to exit button kai topo8etise to sto telos tou para8yrou    
    button4=tk.Button(window, text="Κλείσιμο προγράμματος", command=window.destroy)
    button4.place(x=50,y=600)
# telos codeblock 4


# begin of codeblock 5
    # sxediase to label10 gia to copyright
    label10 = tk.Label(window, text="Developed by Errikos Ntinos and Epsilon Datum Ⓡ 2022")
    # topo8etise to label10 stis syntetagmenes x,y 
    label10.place(x=50,y=750)
# telos codeblock 5


# DEVEL CODEBLOCK #
# edo bazoume ton kodika ypo dokimi.....PROSEXE POU TELEIONEI TO BLOCK






# telos devel codeblock #
###############################################################################

# MHN EISAGEIS TIPOTA KATO APO EDO !!!!
    window.mainloop()   
main()