Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import tkinter as tk
- root = tk.Tk()
- frame0 = tk.Frame(root)
- frame0.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)
- frame1 = tk.Frame(root)
- frame1.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
- frame2 = tk.Frame(root)
- frame2.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
- frame3 = tk.Frame(root)
- frame3.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
- frame4 = tk.Frame(root)
- frame4.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
- entry1 = tk.Entry(frame0, width=25)
- def button1_insert():
- entry1.insert(tk.END, 1)
- entry1.pack(expand=tk.YES, fill=tk.X)
- button1 = tk.Button(frame1, text='7', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button2 = tk.Button(frame1, text='4', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button3 = tk.Button(frame1, text='1', width=5, command=button1_insert).pack(expand=tk.YES, fill=tk.BOTH)
- button4 = tk.Button(frame1, text='0', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button5 = tk.Button(frame2, text='8', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button6 = tk.Button(frame2, text='5', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button7 = tk.Button(frame2, text='2', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button8 = tk.Button(frame2, text='.', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button9 = tk.Button(frame3, text='9', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button10 = tk.Button(frame3, text='6', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button11 = tk.Button(frame3, text='3', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button12 = tk.Button(frame3, text='=', width=5).pack(expand=tk.YES, fill=tk.BOTH)
- button13 = tk.Button(frame4, text='<-', width=4).pack(expand=tk.YES, fill=tk.BOTH)
- button14 = tk.Button(frame4, text='/', width=4).pack(expand=tk.YES, fill=tk.BOTH)
- button15 = tk.Button(frame4, text='*', width=4).pack(expand=tk.YES, fill=tk.BOTH)
- button16 = tk.Button(frame4, text='-', width=4).pack(expand=tk.YES, fill=tk.BOTH)
- button17 = tk.Button(frame4, text='+', width=4).pack(expand=tk.YES, fill=tk.BOTH)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment