Notes-Taking-App

  • A Simple Note-Taking App using Python & Tkinter

    img

Tkinter -

  • Tkinter is a standard Python library used for creating graphical user interfaces (GUIs). It provides a set of tools and widgets that allow you to build windows, buttons, menus, text entry fields, and other visual components for your Python applications.

ttk:

  • The ttk module stands for "Themed Tkinter" and provides a set of improved and themed widgets. These widgets have a more modern and consistent look across different operating systems compared to the default Tkinter widgets. The ttk module includes widgets like buttons, labels, entry fields, comboboxes, progress bars, and more.

  • By importing ttk, you gain access to these themed widgets and can use them in your GUI application. You can create instances of these widgets and add them to your windows or frames, just like the standard Tkinter widgets. The benefit of using ttk widgets is that they have a more polished appearance and often provide additional features or customization options.

messagebox:

  • The messagebox module is a part of Tkinter that provides functions for displaying standard dialog boxes or message boxes to the user. These message boxes can be used to show information, ask for confirmation, or prompt for user input. The module includes functions such as showinfo, showwarning, showerror, askquestion, askyesno, askokcancel, and more.

Style class from ttkbootstrap:

  • The ttkbootstrap library is a Python package that provides Bootstrap-themed styles and widgets for Tkinter applications. It extends the functionality of Tkinter by adding modern and visually appealing styles inspired by the popular Bootstrap framework.

  • By importing the Style class from ttkbootstrap, you can create an instance of the Style class and use it to apply Bootstrap-themed styles to your Tkinter widgets. The Style class provides methods and attributes to customize the appearance of widgets, such as setting colors, fonts, sizes, and other visual properties.

  • Using ttkbootstrap with the Style class allows you to give your Tkinter application a more contemporary and consistent look, similar to websites and applications built with Bootstrap.

JSON -

  • JSON is a widely used data format for storing and transmitting structured data. It is human-readable, lightweight, and easy to parse and generate. The json module in Python allows you to encode Python objects into JSON strings and decode JSON strings into Python objects.

  • By importing the json module, you gain access to functions such as json.dumps(), which converts a Python object into a JSON-formatted string, and json.loads(), which parses a JSON string and returns a corresponding Python object.

  • The json module is commonly used in Python when working with APIs that send or receive data in JSON format, reading and writing JSON files, or when exchanging data between different systems that communicate using JSON.

FUNCTION EXPLANATION -

  • The function add_note() creates a graphical user interface (GUI) element for adding new notes to a notebook. It assumes that you have a notebook container (named notebook) and a dictionary (named notes) to store the notes. The notes are saved to a JSON file called "notes.json".

  • The function load_notes() is responsible for loading notes from a JSON file named "notes.json" and displaying them in the notebook widget. If the file exists, it reads the data from it, creates a new text widget for each note, and adds it as a new tab in the notebook. If the file doesn't exist (FileNotFoundError), the function simply does nothing.

  • The function delete_note() is designed to delete a selected note from the notebook widget and the notes dictionary. It prompts the user with a confirmation dialog to confirm the deletion. If the user confirms the deletion, the note is removed from both the notebook and the notes dictionary, and the updated notes dictionary is saved back to the "notes.json" file.