python - Pygame word wrap -


I am working on the text that appears in my pygme, I am making. I have drawn it from a good place between the text, but wrapping the text overlaps the word just one child, here I wrap my text. Def reOrderChat (nText, nColor): '' Chat text reactions on the screen and new lines' '#' Reorganize the first lines. They are right for C category (1 9, 0, -1): Drawnatat [C + 1] .text = Ductat [C] .cttct DrawnIight [C + 1] .cllor = Draft Chart [C] .roll drone cut [C + 1]. Y = Dave Chatch [C]. -8 # Check "+ + (C + 1) + + +" on "Text" + "is" + Draw [C + 1]. Check # Check whether testLength is more than the length of chat list textLength = g ChatFont.size (nText) [0] if textLength & gt; 459: #todo: Allow custom size chat list (459 gets with GIMP) # todo: Optimize loop lines [[']] word = nText.split () curLine = 0 curLineLength = 0 in the category (Lenan (word)): word = words [i] # if the new line is too long to add a new word, then put it on a new line word length = g.chatFont.size (0) [0] if (curLineLength + WordLength) & Gt; 400: #todo: Why does it work with only 400? #If we have a text on the current line lines, then just go down in a new line. Append ('') curLine + = 1 curlineLength = 0 lines [curline] + = word + '' curlineLength + = wordLength curline + = 1 lines in line: print line print stra (curline) # here creates new chat line This is where the problem is. Draft [curline] .text = line drawn khat [curline] .color = n colorSchhat [curline] .y + = 8 curline - = 1 else: # text fits, so just print it out # At last, the new text in position 1 Add more color draftschat [1] .text = newtest drawback [1] .color = nColor DrawnChat [1] .y + = 8

Here is a screen shot of text, the first two lines There is not enough space between After the first two rows in the MOTD through vacancy: Just fine. When there are multiple rows, am I doing Y values ​​wrong?

text on screen problem

Have you tried to increase the gap between the lines?

  Draft cut [curline] .y + = 12   

If this does not work; Please check if the surface has the correct height.

If at any time, you think it would be necessary to change the font-size. Please, consider using a variable instead of a hard working code. Drawchat [curline] .y + = 8 .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -