Skip to content

Latest commit

 

History

History
68 lines (33 loc) · 2.13 KB

File metadata and controls

68 lines (33 loc) · 2.13 KB

Aim 🎯

To Create a Notepad Application with tkinter

Purpose 🤔

  • This Project helps us understanding how to combine both tkinter and file operations in our code.

Description 📑

  • Every programmer uses notepad or any version of notepad to excute his/her piece of code and get the output.

  • But the only few have an idea what is the technology behind the application, hence our project give a basic idea how a notepad works.

  • Our code build by using basics of python and also a basic module knows as tkinter module.

  • Modules imported are:

    1.tkinter

    2.askopenfilename, asksaveasfilename from tkinter.filedialog

Working 💻

  • First import tkinter module.
  • Now after importing the tkinter now import askopenfilename, asksaveasfilename from tkinter.filedialog.
  • Functions used for the code are as follows:
    1. def open_file():

      • This function is used to open an another saved file into our notepad we have 3 options.

        • default as .txt file

        • text file as .txt file

        • python file as .py

    2. def save_file():

      • This function is used to save the written code into our pc intially we have 3 options.

        • default as .txt file

        • text file as .txt file

        • python file as .py file

Points to remember while working with the code 🔖

  1. Download the code either with .py extension or .ipynb extension.
  2. Make sure you have tkinter installed otherwise use pip install tkinter.
  3. Now run the file since its tkinter module youll get a window as shown in the below output picture.
  4. Now your Notepad is ready you can type python files or text files in the notepad and save it with there respective extensions but if you havent specified the extension by default it will take as text file.
  5. For opening a saved file click open button inorder to open a preloaded file in to your notepad only text and python files.

Output : ✔️

notepad.jpg