Я хочу добавить кнопку, которая закрывает функцию rumus () - PullRequest
0 голосов
/ 01 ноября 2019

Я настраиваю свое назначение и хочу добавить кнопку закрытия, которая может закрыть / очистить функцию rumus ()

Это код, который я создал

from tkinter import*
Variabel = Tk()

output = IntVar()
input = IntVar()
hasil = IntVar()

def rumus():
    canvas_widget = Canvas(Variabel, bg="green", width=400, height=90)
    canvas_widget.place(x=10, y=160)

    Label(Variabel, text="Efisiensi = ", font=20, bg="green").place(x=50, y=175, height=24)
    output_entry = Entry(textvariable=output).place(x=150, y=175, width=75, height=24)
    Label(Variabel, text="x 100% ", font=20, bg="green").place(x=250, y=175, height=24)
    Label(Variabel, text="____________ ", font=20, bg="green").place(x=125, y=200, height=20)
    input_entry = Entry(textvariable=input).place(x=150, y=220, width=75, height=24)
    Tombolentry = Button(Variabel, text="=", bg="white", bd=8, command=hasiloperasi).place(x=325, y=175, height=25)

def hasiloperasi():
    hasil = output.get() / input.get() *100.0
    Label(Variabel, bg="white", text=hasil).place(x=365, y=175, height= 25, width=40)

Judul = Frame(Variabel, height=280, width=420)
Judul.master.title("Rumus TI Kelompok 24")
Judul.pack()

Label(Variabel, text="-KALKULATOR TI-", font=24).place(x=150, y=10, height=24)
Label(Variabel, text="-RUMUS EFISIENSI-", font=24).place(x=140, y=30, height=24)

canvas_widget = Canvas(Variabel, bg="tomato", width=350, height=80)
canvas_widget.place(x=35, y=70)

Label(Variabel, text="Efisiensi = ", font=20, bg="tomato").place(x=50, y=80, height=24)
Label(Variabel, text="Output", font=20, bg="tomato").place(x=150, y=80, height=24)
Label(Variabel, text="x 100%", font=20, bg="tomato").place(x=250, y=80, height=24)
Label(Variabel, text="=", font=20, bg="tomato").place(x=325, y=80, height=24)
Label(Variabel, text="____________ ", font=20, bg="tomato").place(x=125, y=100, height=20)
Label(Variabel, text="Input", font=20, bg="tomato").place(x=155, y=125, height=24)
Tombolentry = Button(Variabel, text="Mulai", bg="lightcoral", bd=8, command=rumus).place(x=180, y=175, height=35)

Judul.mainloop()

Я хочукнопка, которая может закрыть эту функцию rumus (), кто-нибудь, пожалуйста, помогите мне

...