https://github.com/divinemonk/typewriter_effect_python
Create Typewriter effect in Python (3)
https://github.com/divinemonk/typewriter_effect_python
python python-3 python-library python-script python2 python3 typewriter typewriter-animation typewriter-effect typewriter-effects
Last synced: about 2 months ago
JSON representation
Create Typewriter effect in Python (3)
- Host: GitHub
- URL: https://github.com/divinemonk/typewriter_effect_python
- Owner: Divinemonk
- Created: 2021-05-02T10:35:19.000Z (about 4 years ago)
- Default Branch: m41n
- Last Pushed: 2021-09-21T03:55:08.000Z (over 3 years ago)
- Last Synced: 2025-02-05T23:30:45.999Z (4 months ago)
- Topics: python, python-3, python-library, python-script, python2, python3, typewriter, typewriter-animation, typewriter-effect, typewriter-effects
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typewriter / Typing Effect - in Python
### Let's create a program in python to print sentences like someone is actually typing !!
## Code
```
import sys, timedef typing(text):
for character in text:
sys.stdout.write(character)
sys.stdout.flush()
time.sleep(0.05)typing("Hello _ World !!")
```
## Run this code online : [Python Editor](https://www.online-python.com/1Sq2ny9WcD)
---
## Explaination !!
> For people who want to learn & understand what is happening in the code , here is line by line explaination !
### In the first line of code we are importing 'sys' (abbreviation of 'system') & 'time' packages.
```
1. import sys, time
```
[+] More about : [import](https://bit.ly/3udwI3Y) , [sys](https://bit.ly/3eLiX5T) , [time](https://bit.ly/3xFZD2J)
### Now on third line we are creating a function , named 'typing' and passing argument 'text' in it.
```
3. def typing(text):
```
[+] More about : [def](https://bit.ly/2PJAxyQ)
### Next , we are using for loop. This will pass one string to print at a time .
```
4. for character in text:
```
[+] More about : [for loop](https://bit.ly/2QLuiec)
### Next two lines (5 & 6) our program prints given string , one by one .
```
5. sys.stdout.write(character)
6. sys.stdout.flush()
````
[+] More about : [sys.stdout.write()](https://bit.ly/3ePKiDV) , [sys.stdout.flush()](https://bit.ly/2PJAz9W)
### Set the time to print each string . You can change the time within brackets as want.
```
7. time.sleep(0.05)
```
[+] More about : [time.sleep()](https://bit.ly/3ecKeis)
### Here we are calling the function 'typing()' , and giving argument 'Hello _ World !!'
```
9. typing("Hello _ World !!")
```
[+] More about : [calling function](https://bit.ly/3nDsVdN)