Python Editor Update

For the most part I am happy with the videos and everything published so far. I got to work on refactoring the Python Word Editor, and I made a lot of positive progress nearly instantly. One thing I did differently was that I now work with a single array for reading the text instead of two. Both of the arrays were in limited scope, so in terms of memory it was fine. However, this way the code is far less redundant. I also swapped out the counter object I used for a linked list data structure. You can see a diagram below.

Two arrays one where each element is a word and one where each element is a number
Two arrays one where each element is a word and one where each element is a number

Think of two groups of people standing in different, but parallel lines. One group of people could represent shapes such as triangles, squares, etc. The other group could represent quantity, one, two, etc. If you work through both lines sequentially you would get one triangle, two squares, and so on. It’s a little different than a traditional Linked List I think because I think usually the index is explicitly stated, whereas in my case it’s associated with the index of the object it references. It’s far more straightforward than it sounds, especially in the code. As a result I was able to remove the counter object altogether. The only thing I did not do was add the ability to import an image. The reason why is the PDF generation is not all that great, and I’m not trying to compete with Microsoft. Doing it through filedialog is pretty straight forward anyway. Any future updates will be quality of life or little improvements so I am going to consolidate those articles into one with a note about handling images.

If you buy anything from Amazon using the link below I may receive a commission from your purchase at Amazon.
Tech Best Sellers at Amazon

Leave a comment

Your email address will not be published. Required fields are marked *