Skip to content
Advertisement

How do you format text from a file when reading the file into a text box in tkinter?

I’m creating an Inventory project in python using tkinter and one of the things I want it to do is display the entire inventory that is stored in a text file. So far I have it working but the format of the text after its read onto the frame is not aligned and doesn’t look great.

The numbers aren't aligned correctly

JavaScript

Advertisement

Answer

Normally I would use tags for formatting:

JavaScript

Have a look at Tkinter Text Styles Demo

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement