[Python-3000] More PEP 3101 changes incoming

Ron Adam rrr at ronadam.com
Sat Aug 4 17:02:39 CEST 2007



Greg Ewing wrote:
> Ron Adam wrote:
> 
>>      '{0:10;20,f.2}'
>>
>> Works for me.
> 
> It doesn't work for me, as it breaks up into
> 
>    0:10; 20,f.2
> 
> i.e. semicolons separate more strongly than commas
> to my eyes.

And after my reply I realized this looks a bit odd.

     {0:;20,f.2}

But I figured I could get used to it.


An alternative I thought of this morning is to reuse the alignment symbols 
'^', '+', and '-' and require a minimum width if a maximum width is specified.

Then the field aligner would also have instructions for how to align/trim 
something if it is wider than max_width.

    {0:0+7}        'Hello W'

    {0:0-7}        'o World'

    {0:0^7}        'llo Wor'


Where this may make the most sense is if we are centering something in a 
minimum width field, but want to be sure we can see one end or the other if 
it's over the maximum field width.

The trade off is it adds an extra character for cases where only max_width 
would be needed.

    {0:0+20,f.2}



Separators in tkinter:

The text widget has a line.column index.  '1.0' is the first line, and 
first character.

# window geometry is width x height + x_offset + y_offset (no spaces!)
root.geometry("400x300+30+30")


Cheers,
    Ron



More information about the Python-3000 mailing list