Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### main.py ###
- import tkinter
- from calc import calc_from_calc
- mainWindow = tkinter.Tk()
- entry1 = tkinter.Entry(mainWindow)
- entry1.grid(row=0, column=1)
- entry2 = tkinter.Entry(mainWindow)
- entry2.grid(row=1, column=1)
- buttonCalc = tkinter.Button(mainWindow, text="Calculate", command=lambda:calc_from_calc(entry1, entry2, labelResult))
- buttonCalc.grid(row=3, column=1)
- labelResult = tkinter.Label(mainWindow, text='Result is:')
- labelResult.grid(row=4, column=1)
- mainWindow.mainloop()
- ### calc.py ###
- def calc_from_calc(arg1, arg2, arg3):
- result = int(arg1.get()) + int(arg2.get())
- print(result)
- arg3.configure(text="Result is:{}".format(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement