From: jim-on-linux <in...@ve...> - 2006-09-20 04:22:51
|
On Tuesday 19 September 2006 19:17, Tanner=20 Ruschman wrote: > Hey Everybody! > > I'm trying to get help as to the use of rapyd > tk software to create a number speller, but I'm > having a bit of trouble. I thought posting to > the Rapyd-tk google group would help, but > apparently not! > > Heres what my message looked like: > > Hey, > > I have created a simple application with > rapyd-tk that *should* take a typed in number > and turn it into a spelled out number (this is > what the final version should do anyway). Heres > my problem: I have no clue how to hook up a > text entry box to a variable (lets say x for > this example), and have x be parsed into a > spelled number. > > Heres a stupid little command-prompt like > python program I made before to let you see > kind of what I mean: > > *********************************************** >************************************************ >******** x=3Dint(raw_input("Please Enter An > Integer Between 0 and 20: ")) if x<0: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Please type a number between 0 > and 20' elif x=3D=3D0: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Zero' > elif x=3D=3D1: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'One' > elif x=3D=3D2: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Two' > elif x=3D=3D3: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Three' > elif x=3D=3D4: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Four' > elif x=3D=3D5: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Five' > elif x=3D=3D6: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Six' > elif x=3D=3D7: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Seven' > elif x=3D=3D8: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Eight' > elif x=3D=3D9: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Nine' > elif x=3D=3D10: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Ten' > elif x=3D=3D11: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Eleven' > elif x=3D=3D12: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Twelve' > elif x=3D=3D13: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Thirteen' > elif x=3D=3D14: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Fourteen' > elif x=3D=3D15: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Fifteen' > elif x=3D=3D16: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Sixteen' > elif x=3D=3D17: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Seventeen' > elif x=3D=3D18: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Eighteen' > elif x=3D=3D19: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Nineteen' > elif x=3D=3D20: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Twenty' > elif x>20: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'Please type a number between 0 > and 20' > > raw_input("Press ENTER To Close Window...") >=20 Tanner, You can try this and modify as necessary, > class Knumbers : > def __init__(self) : > self.Fnum() > > def Fnum(self) : > vwrite=3D > ['Zero','one','two','three','four'] > > > x =3D 0 > for txt in vwrite : > if ventry <0 or ventry >4 : > x=3D 'invalid entry' > print x > break > if ventry =3D=3D x : > txt =3D vwrite[x] > print txt > break > else: > self.x =3Dx =3Dx+1 > > ## you can use self.x or create Knumbers.x as your=20 variable for all Widget Entries where needed. jim-on-linux http:\\www.inqvista.com > *********************************************** >**************************** > *********************** > This was something that I wanted to give a > gui, where someone could give input through > means of a text box, and after clicking a spell > button, the number they entered would be > converted into spelling. For my gui, i have > created an interface as seen at > http://tinyurl.com/r4sby > > So, heres what I need help with: > 1) How do I assign the entry in the text box > to be a variable? > > 2) How do I parse the variable (or determine > what the user typed, and convert that into text > like the program I created before) > > 3) Off-topic, but is there any way that I can > prevent the program from showing the python > command prompt from showing while the program > is running? > > Thanks for any help, I really appreciate it! > > FlyingIsFun1217 > > I wish that I could have gotten some help > from the people who work more with this, but > that didn't work, so I'm asking everybody on > this mailing list: Can you help me with this > issue? > > thanks! > Tanner |