2023-10-17 17:35:43 +02:00
|
|
|
from tkinter import *
|
|
|
|
from tkinter import messagebox
|
|
|
|
|
|
|
|
window = Tk()
|
|
|
|
window.minsize(width=600, height=600)
|
|
|
|
window.config(padx=50, pady=50)
|
|
|
|
window.title("Regresja")
|
|
|
|
|
|
|
|
|
|
|
|
tytul = Label()
|
|
|
|
tytul.config(text="Wycena wartości mieszkania na podstawie danych z serwisu otodom.pl", padx=70, pady=50)
|
|
|
|
tytul.grid(column=0, row=0, columnspan=2)
|
|
|
|
|
|
|
|
|
|
|
|
metraz = Label()
|
|
|
|
metraz.config(text="Metraż", pady=20)
|
|
|
|
metraz.grid(column=0, row=1)
|
|
|
|
|
|
|
|
metraz_entry = Entry()
|
|
|
|
metraz_entry.grid(column=0, row=2)
|
|
|
|
|
|
|
|
pietro_entry = Entry()
|
|
|
|
pietro_entry.grid(column=1, row=2)
|
|
|
|
|
|
|
|
|
|
|
|
pietro = Label()
|
|
|
|
pietro.config(text="Piętro", pady=20)
|
|
|
|
pietro.grid(column=1, row=1)
|
|
|
|
|
|
|
|
|
|
|
|
przewidywania = Label()
|
|
|
|
przewidywania.config(text="Przewidywanie:", pady=20, padx=5)
|
|
|
|
przewidywania.grid(column=0, row=4, sticky='e')
|
|
|
|
|
2023-10-17 17:47:15 +02:00
|
|
|
wartosc_regresji = Label()
|
|
|
|
wartosc_regresji.config(text="Wartosć przewidywana")
|
2023-10-17 17:35:43 +02:00
|
|
|
wartosc_regresji.grid(column=1, row=4, sticky='w')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def val_numbers():
|
2023-10-17 18:04:34 +02:00
|
|
|
max_metraz = 100000
|
|
|
|
max_piętro = 100
|
2023-10-17 17:35:43 +02:00
|
|
|
metraz = metraz_entry.get()
|
|
|
|
pietro = pietro_entry.get()
|
|
|
|
if metraz == "" or not metraz.isdigit() or pietro=="" or not pietro.isdigit():
|
|
|
|
messagebox.showinfo(title="Error", message=f"Please provide valid data")
|
2023-10-17 18:04:34 +02:00
|
|
|
elif int(metraz) < 0 or int(metraz) > max_metraz or int(pietro) < 0 or int(pietro) > max_piętro:
|
|
|
|
messagebox.showinfo(title="Error", message=f"Please provide numbers between 0 to 100 for floors and 0 to 100.000 for metric area.")
|
2023-10-17 17:35:43 +02:00
|
|
|
else:
|
|
|
|
confirm = messagebox.askyesno(title="Confirm", message="Do you want to start prediction?")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_button = Button(command=val_numbers)
|
|
|
|
start_button.config(text="Start")
|
|
|
|
start_button.grid(column=0, row=3, columnspan=2, sticky="s", pady=20)
|
|
|
|
|
|
|
|
window.mainloop()
|
|
|
|
|
|
|
|
|