Converting Unicode to integer
Nikola Plejic
Nikola.Plejic at pu.CARNet.hr
Wed Aug 28 02:22:05 EDT 2002
Thanks, but this still doesn't work - I get a result of 55 instead of 10...
:(
Any ideas, anyone?
Thanks!
"Terry Reedy" <tjreedy at udel.edu> wrote in message
news:0vQa9.122140$Aw4.5151890 at bin2.nnrp.aus1.giganews.com...
>
> "Nikola Plejic" <Nikola.Plejic at pu.CARNet.hr> wrote in message
> news:akgd1s$lmf$1 at bagan.srce.hr...
> > def handler(**kw):
> > a = txt.text
> > b = txt2.text
> > a = int(a)
> > b = int(b)
> > lbl.text = a + b
>
> You here try to set lbl.txt to an int.
>
> > File "C:\Python22\test2.py", line 8, in handler
> > lbl.text = a + b
> > File "C:\Python22\Lib\site-packages\anygui\Mixins.py", line 137,
> in
> > __setattr__
> > inhibit_refresh = setter(value)
> > File "C:\Python22\Lib\site-packages\anygui\Labels.py", line 15, in
> > _set_text
> > text = text.replace('\r\n', ' ')
> > AttributeError: 'int' object has no attribute 'replace'
>
> Appears you can't do that. Appears lbl.text must be a string -- which
> has replace method -- not an int, which does not. Try lbl.text =
> str(a+b) instead.
>
> TJR
>
>
>
More information about the Python-list
mailing list