'Automatic and clean Textwrap?
i'm trying to make a programm that can print multiple playing cards with a different text for each card on it. I want the programm to automatically jump to the next line when a certan length is reached, just like a regular "textbox" would do. I am making around 120+ cards so i can't be bothered to set the new lines in the string individually with "/n" since i would have to do it by trial and error for every card. Is there some way to make the programm split a one-lined string individually? I tried the Textwrap.fill function but its not pretty since some lines are way to long and others too short.
Line1 = Cards_List[indexCD]
Line1F = Line1.replace('#', '.\n')
Card_Des = textwrap.fill(text=Line1F, replace_whitespace=False, width=45)
draw.text((68,840), Card_Des,(0,0,0), font=Small_Font, spacing=2)
Base.show()
Base.save(Cards_List[indexCN] + '.png')
indexS = 5
indexCC = 1
indexIcon = 9
indexCN = 2
indexCR = 3
indexCQ = 4
indexCT = 6
indexCA = 7
indexCD = 8```
[enter image description here][1]
[1]: https://i.stack.imgur.com/R3oov.png
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
