Creating a text-cleaning widget
- Nicole Seah
- May 27, 2021
- 1 min read
Updated: Jun 12, 2021
Today, I wanted to learn how to make a URL shortener using Python, which made me stumble into the Tkinter module. I understand that there isn't really a good demand for GUIs nowadays, but nevertheless it was quite fun to dive into it and explore around!
I wanted to adopt what I learnt into my own project, and I had an idea to incorporate a simple function I had written during the semester to help in my note-taking.
Basically, the PDF textbook I have been using isn't very user friendly and it doesn't allow you to copy paste the text with ease. There's always a '/n' in between lines, so imagine what it feels like having to 'backspace' a gazillion times manually. The program I made is quite simple but I thought it would be nice to fit it into a GUI app using the pyperclip module (in addition to Tkinter).
Here is a before and after sample of the text I had 'Ctrl+C'ed from my textbook. I had also included a wordcount - just for fun.

I recognise it has some shortcomings - such as its inability to get rid of citation references. I had originally wanted to remove integers using .isdigit() but realised that there may be numbers within the text (i.e. money figures, statistics).
I think the most tedious part about using Tkinter was making the layout (just look at the code required for the layout itself compared to the function).

Hopefully, I get to put this app into good use in the future when I continue doing my note-making during school semesters!


![What I learnt from DSTA's BrainHack [Computer Vision]](https://static.wixstatic.com/media/0291b6_4c5eedac87ab40e69532948815926ba5~mv2.png/v1/fill/w_624,h_309,al_c,q_85,enc_avif,quality_auto/0291b6_4c5eedac87ab40e69532948815926ba5~mv2.png)

Comments