Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- root = Tk()
- root.title("Calculator")
- root.geometry("300x450")
- root.resizable(False, False)
- def xueta():
- print("1")
- frame = Frame()
- frame.place(height=300, width=300, x=0, y=150)
- btn1 = Button(frame, text="1", width=50, height=50, command=xueta)
- btn2 = Button(frame, text="2", width=50, height=50)
- btn3 = Button(frame, text="3", width=50, height=50)
- btn4 = Button(frame, text="4", width=50, height=50)
- btn5 = Button(frame, text="5", width=50, height=50)
- btn6 = Button(frame, text="6", width=50, height=50)
- btn7 = Button(frame, text="7", width=50, height=50)
- btn8 = Button(frame, text="8", width=50, height=50)
- btn9 = Button(frame, text="9", width=50, height=50)
- btn_plus = Button(frame, text="+", width=50, height=50)
- btn_minus = Button(frame, text="-", width=50, height=50)
- btn_multiply = Button(frame, text="*", width=50, height=50)
- btn_divide = Button(frame, text="/", width=50, height=50)
- btn_degree = Button(frame, text="^", width=50, height=50)
- btn_c = Button(frame, text="C", width=50, height=50)
- btn_root = Button(frame, text="R", width=50, height=50)
- btn1.place(x=0, y=0)
- btn2.place(x=75, y=0)
- btn3.place(x=150, y=0)
- btn_plus.place(x=225, y=0)
- btn4.place(x=0, y=75)
- btn5.place(x=75, y=75)
- btn6.place(x=150, y=75)
- btn_minus.place(x=225, y=75)
- btn7.place(x=0, y=150)
- btn8.place(x=75, y=150)
- btn9.place(x=150, y=150)
- btn_divide.place(x=225, y=150)
- btn_multiply.place(x=0, y=225)
- btn_degree.place(x=75, y=225)
- btn_root.place(x=225, y=225)
- btn_c.place(x=150, y=225)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement