Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- class Inch_Real_Size:
- def __init__(self, inch):
- self.inch = inch
- frame= Frame(inch)
- frame.pack()
- Label(frame,text = 'Given Inch').grid(row = 0, column = 0)
- self.I_var = DoubleVar()
- Entry(frame, textvariable= self.I_var).grid(row=0,column=1)
- Label(frame, text = 'Real Size').grid(row=1,column=0)
- self.result_var=DoubleVar()
- Label(frame,textvariable=self.result_var).grid(row=1, column=1)
- button = Button(frame,text = 'Find real size', command =self.convert)
- button.grid(row=2, columnspan=2)
- def convert(inch):
- if inch <= 15:
- return inch / (2*inch)
- elif inch == 5:
- return 5 - 4
- elif inch <= 14:
- return inch * (1/3)
- root = Tk()
- root.wm_title('Real Size')
- Size = Inch_Real_Size(root)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement