Simple Task Manager Update (04/01/23)

Photo of current program
Update 10

In this update I spent a lot of time working on the settings window. I also spent the majority of the time refactoring the code a bit, mainly taking the major parts of the application and turning them into their own classes.

Updates (Summary)

  • Added a green colour to the task highlighting system.
  • Created a settings window which allows the user to adjust how many days in advance a task will be highlighted either yellow or green.
  • Created a settings button which when clicked brings up the settings window.
  • Refactored the code and tried to make each main component of the application its own class.

Key Points

Task highlight system update

I now have three colours that will alert the user when something is due soon.

  • Red: At the moment red indicates that something is due today or is overdue.
  • Yellow: The yellow colour indicates by default that something is due in three days times.
  • Green: The green colour will show before the yellow colour, to indicate that something is due a little bit more later but it is coming up. The default setting for the green colour to appear is 4 days in advance.

The idea for this system is that, green alerts you that “Hey something is due soon you should start working on it.” After the green phase, the colour should then turn yellow to alert the user that these tasks are now getting, even more closer to the due date and you should start to focus on them. Finally, the red will mark tasks as urgent so that the user is aware that something is due today or is overdue. In the future, I would like the user to maybe be able to choose their own custom colours or even disable the feature entirely if they do not like it.

Settings Menu

Screenshot of Simple Task Managers settings menu
Settings menu

I wanted the user to have some flexibility as to when a task should be highlighted as everyone is different. Some users will want to be alerted that a task is coming up 7 days in advance, while other users may only need 2 days’ notice. When I began making the settings window I had it all under one function inside the main file of Simple Task Manager, but I quickly realised that it will be way too much for one function. I know I said in one of my posts that I won’t need any classes as this will be a simple program but it is quickly becoming too much for one file. I decided that the settings window should have its own class. I had made classes before but I was not sure how to make a class around Tkinter components. I looked online but unfortunately, there was not a lot of information on how I would structure a class like this. But after some digging I had a rough idea of how my settings class should be structured and below is the result.

gif of the Settings window class
full code can be found here

Settings Saving Functionality

The settings window as previously stated lets the user adjust how many days in advance a task will be highlighted. For now, you can only change the green colour and the yellow colour. Once the user has made their adjustments they need to click the “Save And Exit” Button, to save their adjustments. If they click the red X on the top right corner their changes will not be saved. Once the user has saved their adjustments, the adjustments are then written to a CSV file so that when the user closes and reopens the application their settings are saved from the last time. I am pretty happy with the result, it was pretty tricky to get the settings window to connect with the main window but after a lot of trying I got it working. There are much more settings that I would like to add in the future, but for now, I am happy with what is there.

Refactoring the code

I made a mistake, I really should of broke my code down into smaller classes from the beginning. But I had no idea how UI worked so I wanted to keep it simple and now the main file is huge. I have learnt since then that each different major component should have its own class. So far I broke down the settings window into its own class and after that was finished I decided to break Treeview down into its own class as well. This would be an even bigger job than the settings class, as originally the settings window was just one function. But Treeview has multiple functions connected to it. I had to carefully take functions from the main file and make them methods of the “Task_Tree” class. After a while, I had the Treeview working as it was before, only this time in a cleaner file. My main file also looked much more compact and easier to read. The “Task_Tree” class can be found here

Conclusion

I learnt a lot working on this update, especially with how windows interact with each other. I am happy that I went back and looked at my code and tried to refactor it a bit. I am sure it could be broken down even further but so far this is the result. If I add any more big features I will try to add them into their own class from now on. The next thing I would like to do in this project is to try and make my application look better. Currently, my program looks like it came straight out of a windows 95 application. I have found a module that I would like to use called Custom Tkinter. This module looks like it is easy to integrate with my application and looks like it can give Simple Task Manager a much-needed UI improvement.
Thank you for reading and see you in the next post.

Leave a Comment