You are on page 1of 20

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

TSSM’s
Bhivarabai Sawant College of Engineering and Research (Polytechnic),
Narhe

Academic year: 2022-23

MICRO PROJECT

ON

Text editor using python

Program: Computer Engg. Program code: CO6I

Course: PWP Course code: 22616

1
MAHARASHTRA STATE

BOARD OF TECHNICAL EDUCATION Certificate

This is to certify that Mr :- Nitesh Gowardhan Borla, Roll No. 50 of VIth Semester of

Diploma in computer engineering of Institute, BSCOER POLYTECHNIC (Code: 1606) has

completed the Micro Project satisfactorily in Subject: Programming With Python for the

academic year 2022- 2023 as prescribed in the curriculum.

Place: - Pune Enrollment No: 2016060144

Date: ……………………… Exam Seat No: 262675

Subject Teacher Head of the Department

Principal

2
GROUP DETAILS

Sr.No Name of group members Roll No Enrollment No Seat No

1 Nitesh Gowardhan Borla 50 2016060144 262675

Name of guide
Prof. Mali. S.L

INDEX

Sr. No. Contents Page No.

3
ABSTRACT
1

INTRODUCTION
2

3 PROJECT INFORMATION

CODE
3

OUTPUT/SCREENSHOT
4

CONCLUSION
5

6 REFERENCES

WEEKLY PROGRESS REPORT


7

ANEEXURE II
8

Text editor using python

4
1. ABSTRACT

As you must be already aware, Notepad is a simple text editor for Microsoft Windows that
allows users to create text documents, save them as plain text, and edit plaintext files. It is
extremely useful for viewing or writing relatively short text documents saved as plain text.

Python feature such as Tkinter + database(sqlite3) etc. We have used visual code platform to
develop the text editor. There are several kinds of functions available in my text editor like
we can make our text bold, italic, normal and colourful. We have developed a real software
which canper form all the basic task similar to MS Word. We have used several kinds of
icons for better navigation, which is very-very useful for the user. This texteditor is helpful
for beginners who want to learn the typing. It is very-very friendly for the new users.

Tkinter interface used for Text editor. Basic tasks like cursor, line number File handling to
manage the text files. Different icons for cut, copy, info, find_ text, new file, open file. Line
numbers and column number display at the bottom. To open and save files, the project is
using Python file handling system and its basic method. The text editor offers functionalities
like open, close, edit and create new files using Python. Texteditor is an application like
notepad to write documents and other files.

2. INTRODUSTION

5
Text editors are essential tools for programmers and developers to write, edit and debug code
efficiently. While there are many popular text editors available, building your own can
provide valuable learning opportunities and the ability to customize the editor to suit your
specific needs. In this project, we will develop a simple text editor using Python. Python is a
powerful and widely-used programming language that offers many useful libraries and tools
for building software applications.

Our text editor will include features such as syntax highlighting, auto-indentation, search and
replace, and file saving and loading capabilities. We will use the Tkinter library, which is a
built-in Python library for creating GUI applications, to develop the graphical interface of our
text editor. Additionally, we will explore other libraries such as Pygments, which is a syntax
highlighting library, to enhance the functionality of our editor.

3. PROJECT INFORMATION

Title: Text Editor using Python

6
Objective: To develop a simple text editor using Python with features such as syntax
highlighting, auto-indentation, search and replace, and file saving and loading capabilities.

Tools/Libraries:

Python 3.x

Tkinter (built-in Python library for GUI development)

Pygments (syntax highlighting library)

Functionality:

GUI interface with a menu bar and toolbar for various functions such as opening, saving, and
editing files.

Syntax highlighting for various programming languages using Pygments library.

Auto-indentation for better code formatting.

Search and replace functionality for easy editing of large documents.

File saving and loading capabilities for convenience and productivity.

Support for various file types including plain text, Python, HTML, CSS, and JavaScript.

Features:

User-friendly interface with clear and easy-to-use features.

Customizable font and color settings for text and syntax highlighting.

Undo and redo functionality for easy undoing of mistakes.

Line numbering for easier navigation of large documents.

Integration with external libraries for enhanced functionality.

4. CODE

# Importing Required libraries & Modules from tkinter import *

7
from tkinter import messagebox self.statusbar =
Label(self.root,textvariable=self.status,font
from tkinter import filedialog =("times new
# Defining TextEditor Class roman",15,"bold"),bd=2,relief=GROOVE)

class TextEditor: # Packing status bar to root window

# Defining Constructor
self.statusbar.pack(side=BOTTOM,fill=B
def _init_(self,root): OTH)

# Assigning root # Initializing Status

self.root = root self.status.set("Welcome To Text


Editor")
# Title of the window
# Creating Menubar
self.root.title("TEXT EDITOR")
self.menubar =
# Window Geometry
Menu(self.root,font=("times new
roman",15,"bold"),activebackground="sky
self.root.geometry("1200x700+200+150") blue")

# Initializing filename # Configuring menubar on root window

self.filename = None self.root.config(menu=self.menubar)

# Declaring Title variable # Creating File Menu

self.title = StringVar() self.filemenu =


Menu(self.menubar,font=("times new
# Declaring Status variable roman",12,"bold"),activebackground="sky
blue",tearoff=0)
self.status = StringVar()
# Adding New file Command
# Creating Titlebar

self.titlebar =
self.filemenu.add_command(label="New",
Label(self.root,textvariable=self.title,font=
accelerator="Ctrl+N",command=self.newf
("times new
ile)
roman",15,"bold"),bd=2,relief=GROOVE)
# Adding Open file Command
# Packing Titlebar to root window

self.titlebar.pack(side=TOP,fill=BOTH)
self.filemenu.add_command(label="Open"
# Calling Settitle Function ,accelerator="Ctrl+O",command=self.open
file)
self.settitle()
# Adding Save File Command
# Creating Statusbar
8
self.filemenu.add_command(label="Save", self.editmenu.add_command(label="Paste
accelerator="Ctrl+S",command=self.savefi ",accelerator="Ctrl+V",command=self.pas
le) te)

# Adding Save As file Command # Adding Seprator

self.editmenu.add_separator()
self.filemenu.add_command(label="Save
As",accelerator="Ctrl+A",command=self.s # Adding Undo text Command
aveasfile)

# Adding Seprator self.editmenu.add_command(label="Undo


",accelerator="Ctrl+U",command=self.und
self.filemenu.add_separator() o)

# Adding Exit window Command # Cascading editmenu to menubar

self.menubar.add_cascade(label="Edit",
self.filemenu.add_command(label="Exit", menu=self.editmenu)
accelerator="Ctrl+E",command=self.exit)
# Creating Help Menu
# Cascading filemenu to menubar
self.helpmenu =
self.menubar.add_cascade(label="File", Menu(self.menubar,font=("times new
menu=self.filemenu) roman",12,"bold"),activebackground="sky
blue",tearoff=0)
# Creating Edit Menu
# Adding About Command
self.editmenu =
Menu(self.menubar,font=("times new
roman",12,"bold"),activebackground="sky self.helpmenu.add_command(label="Abou
blue",tearoff=0) t",command=self.infoabout)

# Adding Cut text Command # Cascading helpmenu to menubar

self.editmenu.add_command(label="Cut", self.menubar.add_cascade(label="Help",
accelerator="Ctrl+X",command=self.cut) menu=self.helpmenu)

# Adding Copy text Command # Creating Scrollbar

scrol_y =
self.editmenu.add_command(label="Copy Scrollbar(self.root,orient=VERTICAL)
",accelerator="Ctrl+C",command=self.cop
y) # Creating Text Area

# Adding Paste text command self.txtarea =


Text(self.root,yscrollcommand=scrol_y.set
,font=("times new

9
roman",15,"bold"),state="normal",relief= self.settitle()
GROOVE)
# updating status
# Packing scrollbar to root window
self.status.set("New File Created")
scrol_y.pack(side=RIGHT,fill=Y)
# Defining Open File Funtion
# Adding Scrollbar to text area
def openfile(self,*args):

scrol_y.config(command=self.txtarea.yvie # Exception handling


w) try:
# Packing Text Area to root window # Asking for file to open
self.txtarea.pack(fill=BOTH,expand=1) self.filename =
# Calling shortcuts funtion filedialog.askopenfilename(title = "Select
file",filetypes = (("All Files","."),("Text
self.shortcuts() Files",".txt"),("Python Files",".py")))

# Defining settitle function # checking if filename not none

def settitle(self): if self.filename:

# Checking if Filename is not None # opening file in readmode

if self.filename: infile = open(self.filename,"r")

# Updating Title as filename # Clearing text area

self.title.set(self.filename) self.txtarea.delete("1.0",END)

else: # Inserting data Line by line into text


area
# Updating Title as Untitled
for line in infile:
self.title.set("Untitled")
self.txtarea.insert(END,line)
# Defining New file Function
# Closing the file
def newfile(self,*args):
infile.close()
# Clearing the Text Area
# Calling Set title
self.txtarea.delete("1.0",END)
self.settitle()
# Updating filename as None
# Updating Status
self.filename = None
self.status.set("Opened Successfully")
# Calling settitle funtion
except Exception as e:
10
messagebox.showerror("Exception",e) # Asking for file name and type to save

# Defining Save File Funtion untitledfile =


filedialog.asksaveasfilename(title = "Save
def savefile(self,*args): file As",defaultextension=".txt",initialfile
# Exception handling = "Untitled.txt",filetypes = (("All
Files","."),("Text Files",".txt"),("Python
try: Files",".py")))

# checking if filename not none # Reading the data from text area

if self.filename: data = self.txtarea.get("1.0",END)

# Reading the data from text area # opening File in write mode

data = self.txtarea.get("1.0",END) outfile = open(untitledfile,"w")

# opening File in write mode # Writing Data into file

outfile = open(self.filename,"w") outfile.write(data)

# Writing Data into file # Closing File

outfile.write(data) outfile.close()

# Closing File # Updating filename as Untitled

outfile.close() self.filename = untitledfile

# Calling Set title # Calling Set title

self.settitle() self.settitle()

# Updating Status # Updating Status

self.status.set("Saved Successfully") self.status.set("Saved Successfully")

else: except Exception as e:

self.saveasfile() messagebox.showerror("Exception",e)

except Exception as e: # Defining Exit Funtion

messagebox.showerror("Exception",e) def exit(self,*args):

# Defining Save As File Funtion op =


messagebox.askyesno("WARNING","You
def saveasfile(self,*args):
r Unsaved Data May be Lost!!")
# Exception handling
if op>0:
try:
self.root.destroy()

11
else: infile.close()

return # Calling Set title

# Defining Cut Funtion self.settitle()

def cut(self,*args): # Updating Status

self.txtarea.event_generate("<<Cut>>") self.status.set("Undone Successfully")

# Defining Copy Funtion else:

def copy(self,*args): # Clearing Text Area

self.txtarea.delete("1.0",END)
self.txtarea.event_generate("<<Copy>>")
# Updating filename as None
# Defining Paste Funtion
self.filename = None
def paste(self,*args):
# Calling Set title

self.txtarea.event_generate("<<Paste>>") self.settitle()

# Defining Undo Funtion # Updating Status

def undo(self,*args): self.status.set("Undone Successfully")

# Exception handling except Exception as e:

try: messagebox.showerror("Exception",e)

# checking if filename not none # Defining About Funtion

if self.filename: def infoabout(self):

# Clearing Text Area messagebox.showinfo("About Text


Editor","A Simple Text Editor\nCreated
self.txtarea.delete("1.0",END) using Python.")

# opening File in read mode # Defining shortcuts Funtion

infile = open(self.filename,"r") def shortcuts(self):

# Inserting data Line by line into text # Binding Ctrl+n to newfile funtion
area
self.txtarea.bind("<Control-
for line in infile: n>",self.newfile)

self.txtarea.insert(END,line) # Binding Ctrl+o to openfile funtion

# Closing File self.txtarea.bind("<Control-


o>",self.openfile)
12
# Binding Ctrl+s to savefile funtion # Binding Ctrl+v to paste funtion

self.txtarea.bind("<Control- self.txtarea.bind("<Control-
s>",self.savefile) v>",self.paste)

# Binding Ctrl+a to saveasfile funtion # Binding Ctrl+u to undo funtion

self.txtarea.bind("<Control- self.txtarea.bind("<Control-
a>",self.saveasfile) u>",self.undo)

# Binding Ctrl+e to exit funtion # Creating TK Container

self.txtarea.bind("<Control- root = Tk()


e>",self.exit)
# Passing Root to TextEditor Class
# Binding Ctrl+x to cut funtion
TextEditor(root)
self.txtarea.bind("<Control-x>",self.cut)
# Root Window Looping
# Binding Ctrl+c to copy funtion
root.mainloop()
self.txtarea.bind("<Control-
c>",self.copy)

5. OUTPUT/SCREENSHOT

13
6. CONCLUSION

In conclusion, the development of a text editor using Python is a challenging yet rewarding
project that requires a combination of programming, GUI development, and external library
integration skills. The project involves the implementation of essential features such as
syntax highlighting, auto-indentation, search and replace, and file saving and loading

14
capabilities, which will help in enhancing productivity and efficiency for users. By
completing this project, one can gain valuable experience in developing GUI applications
using Python and integrating with external libraries. Overall, a fully functional text editor can
be a useful tool for programming or other text-based tasks, and this project provides an
excellent opportunity to learn and practice important programming concepts.

The text editor using Python is a useful project that provides a user-friendly interface with
various features for editing and saving text-based files. It can be used for programming or
other text-based tasks and provides valuable experience in developing GUI applications using
Python and integrating with external libraries. The project timeline provides a clear roadmap
for the development of the project, and the expected outcome is a fully functional text editor
that meets the objectives of the project. Overall, this project is an excellent opportunity to
enhance your skills in Python programming, GUI development, and working with external
libraries.

6.Reference
1. https://www.airccse.org/journal/cnc/5313cnc10.pdf

2. https://www.geeksforgeeks.org/image-steganography-in-cryptography/

3. file:///C:/Users/DELL/Downloads/Paper98.pdf

15
WEEKLY PROGRESS REPORT

MICRO PROJECT

16
SR.NO WEEK ACTIVITY PERFORMED SIGN OF DATE
. GUIDE

17
1. 1st Discussion and finalization of topic

2. 2nd Preparation and submission of Abstract

3. 3rd Collection of Data

4. 4th Discussion and outline of Content

5. 5th Formulation of Content

6. 6th Editing and proof Reading of Content

7. 7th Compilation of Report and Presentation

8. 8th Seminar / Viva voce

9. 9th Final submission of Micro Project

Sign of the student Sign of the faculty

ANEEXURE II

Evaluation Sheet for the Micro Project


Academic Year: 2022-23 Name of the Faculty: Prof. Mali. S.L
Course: PWP Course code: 22616
Semester: VI

18
Title of the project: Implement communication system using
steganography, encrypt image & message using any cryptography
technique.
CO’s addressed by the Micro Project:
Apply the various Steganography and Cryptography concept .
Major Learning outcomes achieved by students by doing the Project:
(b)Unit Outcomes in cognitive Domain
a.  Identify risks related to Computer security and Information hazard in various
situations.
b.  Apply cryptographic algorithms and protocols to maintain Computer Security.

Marks out of 6 Marks out of


for performance 4for
Roll Student Name in group activity performance in Total out of
No (D5 Col.8) oral/ 10
presentation
(D5 Col.9)
50 Nitesh Gowardhan
Borla

19
(Signature of Faculty)
Prof. KARANJE.P.P

20

You might also like