How would I center-align (and middle-vertical-align) text when using PIL?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Code using
textbboxinstead oftextsize.Result
Use
Draw.textsizemethod to calculate text size and re-calculate position accordingly.Here is an example:
and the result:
If your fontsize is different, include the font like this: