An open API service indexing awesome lists of open source software.

https://github.com/0pkunal/dynamic-introduction-with-python

This project includes two Python scripts that generate a typing animation effect in the console.
https://github.com/0pkunal/dynamic-introduction-with-python

python python-3 python3

Last synced: 9 months ago
JSON representation

This project includes two Python scripts that generate a typing animation effect in the console.

Awesome Lists containing this project

README

          

# Dynamic Introduction With Python
* This project includes two Python scripts that generate a **typing animation effect** in the console. By cycling through printable ASCII characters until each correct one is found, the text is revealed step by step. The result is a dynamic output that mimics real-time typing, making simple messages appear more engaging and interactive.
---
## Features
- **Typing animation effect**: Gradually reveals any given string, simulating real-time typing.
- **Two script versions**:
- **`dynamic_introduction.py`** → Uses `sys.stdout.write()` to update text dynamically on the same line, creating a smooth flowing effect.
- **`dynamic_introduction_1.py`** → Uses `print()` to show progress line by line, giving a step-by-step display of the text being typed.
---
## Files Included
1. **`dynamic_introduction.py`**
- Uses `sys.stdout.write()` and `sys.stdout.flush()` to update text on the same line dynamically.
- Provides a smooth **typing animation effect** in the console.
- Example output effect:
```
N
Ni
Nic
Nice
Nice ...
```

2. **`dynamic_introduction_1.py`**
- A simpler version that uses `print()` instead of `sys.stdout.write()`.
- Text is displayed **line by line**, showing the progression of the animation.
- Example output effect:
```
N
Ni
Nic
Nice
Nice ...
```
---
## How It Works
1. The script defines the target text:
```python
text = "Nice to meet you, I'm Kunal"

2. It initializes an empty string (`temp`) to build the output progressively.

3. For each character in `text`:

* The script loops through **all printable characters** (`string.printable`).
* If the current character matches:

* The character is added to `temp`.
* A short delay (`time.sleep(0.05)`) simulates typing.
* Otherwise, the loop continues with a smaller delay (`time.sleep(0.001)`) to maintain the illusion of searching for the correct character.

4. Adjustable speed using `time.sleep()` delays.

5. Demonstrates the use of `string.printable` for character iteration.
---
## Running the Scripts

1. Clone the repository:

```bash
git clone https://github.com/0PKunal/Dynamic-Introduction-with-Python.git
```
2. Navigate into the folder:

```bash
cd Dynamic-Introduction-with-Python
```
3. Run the script:

```bash
python dynamic_introduction.py
```

or

```bash
python dynamic_introduction_1.py
```
---
## Key Differences

| Feature | `dynamic_introduction.py` | `dynamic_introduction_1.py` |
| ------------------------- | -------------------------- | --------------------------- |
| Output Style | Updates in place (dynamic) | Prints line by line |
| Uses `sys.stdout.write()` | ✅ | ❌ |
| Animation Smoothness | More fluid | More step-by-step |
---
## Possible Improvements

* Add **colorful text effects** using the `colorama` or `rich` library.
* Allow the user to **input custom text** instead of hardcoding.
* Control speed with **command-line arguments** for flexible animation timing.
* Export the animation to a file or GUI for more interactive effects.
---
## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

```
MIT License

Copyright (c) 2025 0PKunal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
```
---


Made with ❤️ by 0PKunal


If this project helped you, please give it a ⭐️