Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pythonic_command.py
- from Tkinter import *
- root = Tk()
- def cash(price=0):
- def wrap():
- total.set(int(total.get()) + price)
- return wrap
- Button(root, text = "ones",width = 20, command = cash(1)).pack()
- Button(root, text = "tens",width = 20, command = cash(10)).pack()
- Button(root, text = "hundreds",width = 20, command = cash(100)).pack()
- Button(root, text = "thousands",width = 20, command = cash(1000)).pack()
- total = StringVar()
- total.set(0)
- Label(root, text = '$').pack(side=LEFT)
- Label(root, textvariable = total).pack(side=LEFT)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement