/pyeditor

Text Editor written in python - tkinter

Primary LanguagePython

PyEditor

Overview

PyEditor is a simple and lightweight text editor built with Python's Tkinter framework. It allows users to open, edit, save, and manage text files efficiently from a user-friendly graphical interface.

Features

  • File Management: Open, edit, and save text files.
  • MD5 Checksum: Calculate MD5 checksums for file contents to ensure data integrity.
  • Graphical Interface: An easy-to-use GUI built with Tkinter.
  • Scroll Support: Integrated scrollbar for easy navigation within text files.

Installation Instructions

To install and set up PyEditor, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/pyeditor.git
    cd pyeditor
  2. Install dependencies: Ensure you have Python and Tkinter installed. If not, you can install Tkinter using:

    sudo apt-get install python-tk
  3. Run the application:

    python mainwindow.py

Usage Examples

To use PyEditor, simply follow these steps:

  1. Launch the editor:

    python mainwindow.py
  2. Open a file: Use the file menu to open an existing file.

    from tkFileDialog import askopenfilename
    
    filename = askopenfilename()
    if filename:
        with open(filename, 'r') as file:
            content = file.read()
        print(content)
  3. Edit the content: Modify the text as needed in the text area.

  4. Save the file: Use the save option in the file menu to save your changes.

Code Summary

The project structure consists of the following key files:

  • buffer.py: Manages the content within the editor using a Tkinter Text widget. It initializes the text area and sets up the scrollbar.

    class Buffer(tk.Text):
        def __init__(self, master, filename=None, modified_callback=None):
            self.filename = filename
            tk.Text.__init__(self, master, height=20, width=72)
            # Additional configuration and setup
  • mainwindow.py: Defines the main window of the editor, manages buffers, handles file dialogs, and integrates other components.

    class MainWindow(Frame):
        def __init__(self, master=None):
            self.master.title('pyeditor')
            self.master.geometry('640x480')
            self.buffers = []
            self.create_widgets()
            # Additional initialization
  • text.py: Houses text manipulation tools, including the MD5 checksum function.

    def md5sum(contents):
        return md5.md5(contents).digest()

Contributing Guidelines

We welcome contributions from the community. To contribute:

  1. Fork the repository.

  2. Clone your fork:

    git clone https://github.com/yourusername/pyeditor.git
    cd pyeditor
  3. Create a new branch for your feature or bugfix:

    git checkout -b feature-name
  4. Commit your changes:

    git commit -m "Description of your changes"
  5. Push to your fork:

    git push origin feature-name
  6. Create a pull request.

Ensure your code adheres to the project's coding standards and includes tests where applicable.

License

This project is licensed under the MIT License. See the LICENSE file for more details.