Re: text wrapping help

2007-02-28 Thread Bjoern Schliessmann
Ryan K wrote: > It doesn't even run but when I go through it interactively it > seems okay. Once again, any help is appreciated. I haven't tested yet, but why don't you make a list of words of the text (with split), and then accumulate words in a list until the next word would make the line too l

Re: text wrapping help

2007-02-28 Thread attn . steven . kuo
On Feb 28, 5:50 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote: > > > Try: > > > import re > > sample_text = """Personal firewall software may warn about the > > connection IDLE makes to its subprocess using this computer's internal > > loopback interface. T

Re: text wrapping help

2007-02-28 Thread Ryan K
That works great but I need to replace the newlines with 24-(the index of the \n) spaces. On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote: > On Feb 28, 4:06 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > > > I'm trying to text wrap a string but not using the textwrap module. I > > have 24x9 "matrix" and

Re: text wrapping help

2007-02-28 Thread attn . steven . kuo
On Feb 28, 4:06 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > I'm trying to text wrap a string but not using the textwrap module. I > have 24x9 "matrix" and the string needs to be text wrapped according > to those dimensions. Is there a known algorithm for this? Maybe some > kind of regular expression

Re: text wrapping help

2007-02-28 Thread Sick Monkey
I am not certain if I understand your problem, but I think you are just trying to read in a string and create a visable matrix. If that is true, then may some of the code below will work. This is in no way elegant. ++ count = 1 width = 2

Re: text wrapping help

2007-02-28 Thread Ryan K
Okay, I was a little vague in my last post...the matrix is like a Wheel of Fortune board and it knows nothing about newlines. After 24 characters it spills over onto the next line. Here is what I came up with: ## Wrap Text def wrap_text(in_str, chars_line): """ wrap text """ spaces = 0

text wrapping help

2007-02-28 Thread Ryan K
I'm trying to text wrap a string but not using the textwrap module. I have 24x9 "matrix" and the string needs to be text wrapped according to those dimensions. Is there a known algorithm for this? Maybe some kind of regular expression? I'm having difficulty programming the algorithm. Thanks, Ryan