|
| 1 | +# 📝 Real-Time Collaborative Text Editor (Diff-Based) |
| 2 | + |
| 3 | +[](https://www.python.org/) |
| 4 | +[](https://opensource.org/licenses/MIT) |
| 5 | +[](https://github.com/yourusername/yourrepo/stargazers) |
| 6 | + |
| 7 | +A Python-based **real-time collaborative text editor** with diff-based updates, floating colored cursors, and username labels — designed to feel like Google Docs. Built using `ttkbootstrap` for a modern **Flatly theme**. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## 🌟 Features |
| 12 | + |
| 13 | +- Real-time collaborative editing over a local network or internet. |
| 14 | +- **Diff-based updates** using Python `difflib` for minimal network usage. |
| 15 | +- **Floating colored cursors** for all collaborators. |
| 16 | +- **Username labels** next to each cursor. |
| 17 | +- Efficient and scalable for hundreds of users. |
| 18 | +- Modern, sleek **Flatly theme** via `ttkbootstrap`. |
| 19 | +- Works cross-platform: **Windows, macOS, Linux**. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## 📸 Screenshots |
| 24 | + |
| 25 | +**Single Client Editing:** |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +**Multiple Users Collaborative View:** |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +*Note: Replace the above image paths with your actual screenshots in `screenshots/` folder.* |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## 🛠 Requirements |
| 38 | + |
| 39 | +- **Python 3.10+** |
| 40 | +- Python packages: |
| 41 | +```bash |
| 42 | +pip install ttkbootstrap websockets pillow |
| 43 | +``` |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## 📂 Project Files |
| 48 | + |
| 49 | +- `server_diff_graceful.py` – WebSocket server handling diff updates, cursors, and usernames. |
| 50 | +- `client_diff_floating_cursors.py` – Collaborative client with diff-based editing, floating cursors, and username labels. |
| 51 | +- `README.md` – This file. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## 🚀 Usage |
| 56 | + |
| 57 | +### 1️⃣ Start the Server |
| 58 | + |
| 59 | +```bash |
| 60 | +python server_diff_graceful.py |
| 61 | +``` |
| 62 | + |
| 63 | +- The server runs on `0.0.0.0:8765` by default. |
| 64 | +- Press **Ctrl+C** to stop gracefully. |
| 65 | + |
| 66 | +### 2️⃣ Start a Client |
| 67 | + |
| 68 | +```bash |
| 69 | +python client_diff_floating_cursors.py |
| 70 | +``` |
| 71 | + |
| 72 | +- Enter a **unique username** when prompted. |
| 73 | +- The editor window will open. You can start typing and collaborate in real-time. |
| 74 | + |
| 75 | +### 3️⃣ Multi-User Collaboration |
| 76 | + |
| 77 | +- Run multiple clients on the same or different machines connected to the server. |
| 78 | +- Features you’ll see in real-time: |
| 79 | + - **Floating colored cursors** for each user. |
| 80 | + - **Username labels** next to cursors. |
| 81 | + - Live document updates from all collaborators. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## ⚙ How It Works |
| 86 | + |
| 87 | +- **Diff-Based Syncing**: Only changes are sent over the network, making it bandwidth-efficient. |
| 88 | +- **Floating Cursors & Labels**: Cursors and labels are drawn visually without modifying the actual text content. |
| 89 | +- **Async + Threaded**: Smooth updates using `asyncio` alongside Tkinter GUI. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## 🎨 Customization |
| 94 | + |
| 95 | +- **Server IP / Port**: Modify `SERVER_URI` in `client_diff_floating_cursors.py`. |
| 96 | +- **Cursor Colors**: Edit the `colors_list` variable for different cursor/label colors. |
| 97 | +- **UI Theme**: Change the `themename` in `tb.Window()` to use other `ttkbootstrap` themes. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 💡 Notes |
| 102 | + |
| 103 | +- All clients must connect to the **same server IP and port**. |
| 104 | +- Designed for **text documents**. Very large files may affect Tkinter performance. |
| 105 | +- Ideal for collaborative note-taking, coding experiments, or teaching demos. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 📝 License |
| 110 | + |
| 111 | +MIT License – Free to use, modify, and distribute. |
| 112 | +See the [LICENSE](LICENSE) file for details. |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## ❤️ Contribution |
| 117 | + |
| 118 | +- Star the repository if you find it useful! |
| 119 | +- Open issues or PRs for bug fixes, improvements, or new features. |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +Enjoy **real-time collaborative editing** with colored cursors and live username labels! |
0 commit comments