Hey,
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:
+--------------------------------+-----------------------------------+
var=StringVar()
def collect():
var.set(entrybo x.get())
spelledentry=La bel(root, textvariable=va r)
spelledentry.gr id(row=5, column=1)
filler1=Label(r oot, text=" ")
filler1.grid(ro w=0, column=0)
titletext=Label (root, text="NumberSpe ller2")
titletext.grid( row=0, column=1)
filler2=Label(r oot, text=" ")
filler2.grid(ro w=0, column=2)
filler3=Label(r oot, text="\n")
filler3.grid(ro w=1, column=0)
entrybox=Entry( root)
entrybox.grid(r ow=1, column=1, sticky=N)
enterbutton=But ton(root, text="Spell!", command=collect )
enterbutton.gri d(row=3, column=1, sticky=N)
filler4=Label(r oot, text="")
filler4.grid(ro w=4, column=1)
filler5=Label(r oot, text="")
filler5.grid(ro w=6, column=1)
website=Label(r oot, text="Visit the NS2 Website")
website.grid(ro w=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
text.
Can someone explain how I could go across doing this?
Thanks!
Tanner
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:
+--------------------------------+-----------------------------------+
var=StringVar()
def collect():
var.set(entrybo x.get())
spelledentry=La bel(root, textvariable=va r)
spelledentry.gr id(row=5, column=1)
filler1=Label(r oot, text=" ")
filler1.grid(ro w=0, column=0)
titletext=Label (root, text="NumberSpe ller2")
titletext.grid( row=0, column=1)
filler2=Label(r oot, text=" ")
filler2.grid(ro w=0, column=2)
filler3=Label(r oot, text="\n")
filler3.grid(ro w=1, column=0)
entrybox=Entry( root)
entrybox.grid(r ow=1, column=1, sticky=N)
enterbutton=But ton(root, text="Spell!", command=collect )
enterbutton.gri d(row=3, column=1, sticky=N)
filler4=Label(r oot, text="")
filler4.grid(ro w=4, column=1)
filler5=Label(r oot, text="")
filler5.grid(ro w=6, column=1)
website=Label(r oot, text="Visit the NS2 Website")
website.grid(ro w=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
text.
Can someone explain how I could go across doing this?
Thanks!
Tanner
Comment