[Tutor] Times Tables Program that constantly tells you that you are wrong!

Alan Gauld alan.gauld at yahoo.co.uk
Wed Aug 15 06:10:16 EDT 2018


On 15/08/18 10:18, Peter Otten wrote:
> Matthew Polack wrote:
> 
>> *Question 2:*
>> Is there a way to centre text within the text frame? I can change the font
>> and size...but don't know how to centre it?
> 
> Ok, I wanted to know it myself, and found
> 
> https://stackoverflow.com/questions/42560585/how-do-i-center-text-in-the-tkinter-text-widget

Well done Peter. I've looked for ways to do this
(and other format tricks)  several times and
failed. I never thought of looking at tags though...

Using the string methods as I suggested relies on
using monospace fonts, and splitting the text
manually into lines of appropriate length - a major
pain.

This works with proportional fonts and long text too.
So much better.

Thanks again for your superior google skills :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list