from tkinter import *
from random import* 
root = Tk ()
root.title("Метереологічні дослідження")
root.geometry("350x230")

def btn_click():
    Lbox1.delete(0, END)
    Lbox2.delete(0, END)
    a = []
    k = 0
    for i in range (7):
        a.append(randint(-5, 8))
        Lbox1.insert(END,a[i])
    L_max["text"]= "Max=" + str(max(a))
    L_min["text"]= "Min=" + str(min(a))
    for i in range (7):
        if a[i] > 0 :
            Lbox2.insert(END,(str(i+1) + "- " + str(a[i])))
            k = k + 1
            K["text"]= "K=" + str(k)
    

L1=Label(text="Температура")
L1.place(x=20, y=10)

L2=Label(text="Теплі дні")
L2.place(x=100, y=10)

Lbox1=Listbox(height=10, width=10)
Lbox1.place(x=20, y=40)

Lbox2=Listbox(height=10, width=10)
Lbox2.place(x=100, y=40)

btn=Button(text="Обчислити", command=btn_click)
btn.place(x=200, y=10)

L_max=Label(text="Max =")
L_max.place(x=200, y=40)

L_min=Label(text="Min =")
L_min.place(x=200, y=70)

K=Label(text="K =")
K.place(x=200, y=100)

root.mainloop ()