How to make a simple but robust text editor in tkinter

sureshsubedi

Hello everyone!

I love writing text editors. I have written many in many languages: Java, Javascript and Html, Python, Qt. Today I’ll share with you an example in python 3 and tkinter.

Our text editor will be able to open and save files (obviously). What our text editor does that other examples often don’t is it will ask us to save our changes (if there are any) before creating new file, opening another file or closing the program. We will be writing it in python 3 and tkinter.You can extend it yourself to extend its features.Text Editor

#!/usr/bin/env python3# -*- coding: utf-8 -*-from tkinter import Tk, Text, Scrollbar, Menu, messagebox, filedialog, BooleanVar, Checkbutton, Label, Entry, StringVar, Grid, Frame
import os, subprocess, json, string

classEditor():
    def__init__(self, root):
        self.root = root        
        self.TITLE = "Subedi Editor"
        self.file_path = None
        self.set_title()
        
        frame = Frame(root)
        self.yscrollbar = Scrollbar(frame, orient="vertical"

View original post 610 more words