changing numbers to spellings

flyingisfun1217 at flyingisfun1217 at
Sun Oct 1 05:24:38 CEST 2006


Sorry to bother everybody again, but this group seems to have quite a
few knowledgeable people perusing it.

Here's my most recent problem: For a small project I am doing, I need
to change numbers into letters, for example, a person typing in the
number '3', and getting the output 'Three'. So far, I have an interface
that only collects numbers (or letters), and displays them in a text
variable label (as you can see below). Heres the code I have:



def collect():

spelledentry=Label(root, textvariable=var)
spelledentry.grid(row=5, column=1)

filler1=Label(root, text="                    ")
filler1.grid(row=0, column=0)

titletext=Label(root, text="NumberSpeller2")
titletext.grid(row=0, column=1)

filler2=Label(root, text="                    ")
filler2.grid(row=0, column=2)

filler3=Label(root, text="\n")
filler3.grid(row=1, column=0)

entrybox.grid(row=1, column=1, sticky=N)

enterbutton=Button(root, text="Spell!", command=collect)
enterbutton.grid(row=3, column=1, sticky=N)

filler4=Label(root, text="")
filler4.grid(row=4, column=1)

filler5=Label(root, text="")
filler5.grid(row=6, column=1)

website=Label(root, text="Visit the NS2 Website")
website.grid(row=7, column=1, sticky=S)


Like I explained a little before, I need to keep users from entering
any letters, and I need to have the numbers they typed in translated to

Can someone explain how I could go across doing this?


More information about the Python-list mailing list