[Tutor] Activating a box

moore william red_necks25 at yahoo.com
Sun Feb 1 16:11:08 EST 2004


I am adding boxes to my program and am looking for
informatioin to get my box to activate diffrent parts
of my program. Anyone have a toutorial on this?

Example:

(BOX)
# File: toolbar1.py

from Tkinter import *

root = Tk()

def Deposite():
    print "Amount:"

# create a toolbar
toolbar = Frame(root)

b = Button(toolbar, text="Deposite", width=10,
command=Deposite)
b.pack(side=LEFT, padx=2, pady=2)

b = Button(toolbar, text="Withdraw", width=10,
command=Deposite)
b.pack(side=LEFT, padx=2, pady=2)

toolbar.pack(side=TOP, fill=X)

mainloop()

(Action)


#   I added the exception line so that negartive
numbers woudl not be added.

    if choice == 1:
        amount = raw_input ('Amount: ')
    elif amount < 0:
        raise ValueError, 'Deposites must be positive'
    elif self.balance - amount < 0:
        raise ValueError, 'The account only holds $' +
str(self.balance)
        self._perform_transaction(-amount) 
        date = raw_input ('Date: ')
        numbers[amount] = date


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



More information about the Tutor mailing list