Enter the purchase amount (partition amount) and sales amount (delivery amount) to automatically calculate the cost rate. Subtract the cost rate from 1 to get the profit rate.
import tkinter as tk
root=tk.Tk()
root.geometry('300x200')
root.title('margin')
def btn_click():
x=float(txt_1.get())
y=float(txt_2.get())
z=txt_3.insert(0,x/y)
lbl_1 = tk.Label(text='Partition')
lbl_1.place(x=30, y=70)
lbl_2 = tk.Label(text='delivery')
lbl_2.place(x=30, y=100)
lbl_3 = tk.Label(text='Cost rate')
lbl_3.place(x=30, y=130)
txt_1 = tk.Entry(width=20)
txt_1.place(x=90, y=70)
txt_2 = tk.Entry(width=20)
txt_2.place(x=90, y=100)
txt_3 = tk.Entry(width=20)
txt_3.place(x=90, y=130)
btn = tk.Button(root, text='Run', command=btn_click)
btn.place(x=140, y=170)
root.mainloop()
Recommended Posts