Linux/Windows Text Editor in Tkinter
3.x Compatibility

If you want to make this compatible with Python 3.x, you'd have to do a few things. First off, in Python 3.x, Tkinter has been renamed to tkinter, so at the top of your file you might want to do something like this:

try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk


You should also use parentheses in print, like this:

print( ... )




Style and other nitpicks

Generally, you shouldn't be using wildcard imports like this:

from Tkinter import *


If you don't like prefixing everything with Tkinter, you can just do this:

import Tkinter as tk


Rather than importing multiple modules on the same line, like this:

import sys, os


It's better to import them all on separate lines, like this:

import sys
import os


It's also very bad practice to have a bare except clause, like this:

try:
    ...
except:
    ...


Any program error that you don't want to catch will go un-noticed . This is not good. You should be doing something like this instead:

try:
    ...
except TheErrorYouWantToCatch:
    ...


You should also have two blank lines between functions, not one, like this:

def a():
    ...


def b():
    ...


On the note of functions, you should also have docstrings describing the purpose of your functions. A typical docstring looks something like this:

def my_function( ... ):
    """Brief description.

    More detailed description.

    Description of arguments.
    """
    ...


Your naming is also, not the greatest. For example, I'd rename the following variables:


file_input to input_file_path.
_FILE_ to file_contents.