A decentralized peer-to-peer chat implementation for educational purposes, supporting both console and GUI interfaces.
By Dedkov Ivan
- Dual Interface - Choose between console or graphical UI
- File Transfer - Share files directly through the chat
- Dynamic Port Management - Change ports without restarting (only in console mode)
- Contact Management - Save and organize your chat partners
- Local Network Support - Option to run in localhost mode
- Python 3.10+
- Tkinter (usually included with Python)
git clone https://github.com/durak-online/python-chat.git
cd python-chat# Basic startup
python main.py
# Localhost mode
python main.py -l
# Console-only mode
python main.py -c
# Custom port configuration
python main.py -p 9000
# Combined options
python main.py -l -p 8000 # Localhost on port 8000| Command | Syntax | Description |
|---|---|---|
| Add Contact | /add <username> <ip> <port> |
Save new chat partner |
| Send Message | /send <username> <message> |
Direct message to contact |
| Send File | /sendfile <username> <path> |
Transfer files (supports paths) |
| List Contacts | /list |
Show all saved contacts |
| Clear Contacts | /clear |
Reset contact list |
| Change Name | /chname <newname> |
Update your display name |
| Change Port | /chport <port> |
Switch listening port |
| Exit | /exit |
Quit application |
- Chat List Panel (Left)
- Active conversations
- "New Chat" button
- Click to switch chats
- Message Display (Center)
[14:32:15] Alice: Hello everyone! [14:33:23] You: Hi Alice! - Input Area (Bottom)
[Message Input Field] [Send Button]
- New Chat Setup
1. Click "New Chat"
2. Fill:
- Chat Name: John Doe
- IP: 192.168.1.5
- Port: 8000
3. Click "Add"
- File Transfers
# Console
/sendfile colleague report.pdf
# GUI
1. Click "Send File"
2. Choose file you want to share
3. Click "Open"
DEFAULT_PORT = 8000
LOCALHOST_IP = "127.0.0.1"
.
├── chat_downloads/ # Received files
├── history/ # Chats history
├── config.json # User preferences
└── contacts.json # Contact list
- Connection Refused
# Verify ports match netstat -ano | findstr :8000 # port on which you run app
- Missing Dependencies
pip install tk