range and wx co - ords

Malcolm Clift mj.clift at virgin.net
Mon Nov 8 17:07:17 EST 2004


Hi All,

Using wx, I'm trying to draw all items in a range of 50 in a text at
certain co -ordinates (a simply textwrap) . A while back Alex Martelli
was kind enough to give me the following to work with ;

for i in range(len(text)):
    dc.DrawText(text, 100, 100 + ( i // 50 *200)

I have slightly changed this to control the spacing between the
letters by adding this;

dc.DrawText(text[i], 100 + ( i * 12 ), 100 + (i//50)*200)

This starts the new line at the right y co-ordinate, but the x remains
at the position where the last line finished. Would anyone know how to
start the line from the starting x co - ords?


I have had an idea to do it another way, but need some help with this
also.

for i in range(len(text), 50)):
    spacer = 200
    dc.DrawText(text[i], 100 + ( i * 12 ), 100 + spacer )

This of course just draws the items at the every 50 mark, as you might
gather, what I want to say is that for every 50 items draw them at
these co - ordinates then go on to the next 50.



Thanks for any help,

Malcolm



More information about the Python-list mailing list