Convert String to list of chars

2007-01-26 Thread juanefren
How can I convert a string to a char list?
for example

"hello" --> ['h','e','l','l','o']

I have been searching but I can't find my answers

thanks

-- 
Juan Efrén Castillo Encinas
-- 
http://mail.python.org/mailman/listinfo/python-list


specify max width to reportlab.canvas.drawString

2009-09-18 Thread juanefren
I am using reportlab to create pdf documents, everything looks fine,
how ever, is there a way to specify a max width to drawString
function ? I mean cut the sentence and continue a step down...

Cheers
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: specify max width to reportlab.canvas.drawString

2009-09-21 Thread juanefren
On Sep 18, 3:20 am, Robin Becker  wrote:
> juanefren wrote:
> > I am usingreportlabto create pdf documents, everything looks fine,
> > how ever, is there a way to specify a max width to drawString
> > function ? I mean cut the sentence and continue a step down...
>
> > Cheers
>
> You'll get better results asking at thereportlabuser group
>
> [email protected]
>
> but there are some ways to do what you want just with simple string 
> manipulation.
>
> Assuming you know the initial x, y and have setup a canvas with the font and
> sizeand the maximum width you want.
>
> fromreportlab.lib.utils import simpleSplit
> L = simpleSplit(text,canv._fontname,canv._fontsize,maxWidth)
>
> for t in L:
>         canv.drawString(x,y,t)
>         y -= canv._leading
>
> I haven't tested this code, but that's the principle anyway for direct drawing
> to the canvas.
> --
> Robin Becker

It worked very good, thank you :)
-- 
http://mail.python.org/mailman/listinfo/python-list