Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ddb0000/realtimepy
real time ipython pygame visualization
https://github.com/ddb0000/realtimepy
educational ipython pygame python realtime
Last synced: 24 days ago
JSON representation
real time ipython pygame visualization
- Host: GitHub
- URL: https://github.com/ddb0000/realtimepy
- Owner: ddb0000
- Created: 2024-01-07T19:01:24.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-10T11:40:53.000Z (10 months ago)
- Last Synced: 2024-09-29T18:23:51.700Z (about 1 month ago)
- Topics: educational, ipython, pygame, python, realtime
- Language: Python
- Homepage:
- Size: 6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# realtimepy
![realtimepy in action](https://raw.githubusercontent.com/ddb0000/realtimepy/main/rtpy.gif)dynamic particle simulation with real-time logging and interactive controls. `pygame` + `ipython`
### run
```
pip install -r requirements.txt
``````
py realtimepy.py
```### fun
interact with the simulation using these functions or create new ones:
```python
change_global_speed(factor)
randomize_directions()
change_particle_size(new_size)
adjust_gravity(new_gravity)
toggle_bouncing()
update_particle_colors(new_r, new_g, new_b)
```
add new particles to the simulation with a custom function. define the function and use it in the ipython shell:
```python
def add_particles(count, size=3, speed=2.0):
global particles
for _ in range(count):
new_particle = Particle(screen_width, screen_height)
new_particle.size = size
new_particle.speed = speed
particles.append(new_particle)
# use in ipython shell
add_particles(50, size=5, speed=1.5)
```