- This Project helps us understanding how to combine both tkinter and file operations in our code.
-
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.
tkinter2.
askopenfilename, asksaveasfilename from tkinter.filedialog
- First import
tkintermodule. - Now after importing the tkinter now import
askopenfilename, asksaveasfilename from tkinter.filedialog. - Functions used for the code are as follows:
-
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
-
-
-
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
-
-
-
- Download the code either with
.py extensionor.ipynb extension. - Make sure you have tkinter installed otherwise use
pip install tkinter. - Now run the file since its tkinter module youll get a window as shown in the below output picture.
- 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.
- For opening a saved file click open button inorder to open a preloaded file in to your notepad only text and python files.
