Pygame for humans
Project description
hooman
~ pygame for humans
pip install hooman
demos
from hooman import Hooman
import pygame
hapi = Hooman(500, 500)
def handle_events(event):
if event.type == pygame.QUIT:
hapi.is_running = False
hapi.handle_events = handle_events
while hapi.is_running:
hapi.background((255, 255, 255))
hapi.no_stroke()
mx = (hapi.mouseX() / hapi.WIDTH) * 255
hapi.fill((0, mx, 0))
for i in range(50 , 200, 60):
hapi.rect(i, 50, 30, 30)
hapi.fill((255, 0, 0))
hapi.ellipse(hapi.mouseX(), hapi.mouseY(), 10, 10)
hapi.stroke_size(1)
hapi.stroke((255, 10, 10))
hapi.line(0, hapi.mouseY(), hapi.mouseX()-10, hapi.mouseY())
hapi.flip_display()
hapi.event_loop()
pygame.quit()
from hooman import Hooman
import pygame
hapi = Hooman(500, 500)
def handle_events(event):
if event.type == pygame.QUIT:
hapi.is_running = False
hapi.handle_events = handle_events
while hapi.is_running:
hapi.background((255, 255, 255))
hapi.stroke_weight(5)
hapi.stroke((0, 255, 0))
for i in range(0, hapi.WIDTH, 20):
hapi.line(i, 0, hapi.mouseX(), hapi.mouseY())
hapi.flip_display()
hapi.event_loop()
pygame.quit()
from hooman import Hooman
import pygame
hapi = Hooman(500, 500)
def handle_events(event):
if event.type == pygame.QUIT:
hapi.is_running = False
hapi.handle_events = handle_events
size = 50
while hapi.is_running:
hapi.background((255, 255, 255))
hapi.no_stroke()
hapi.fill((0, 255, 0))
hapi.rect(10, 10, size, size)
hapi.fill((255, 255, 0))
hapi.rect(100, 100, size, size)
hapi.fill((255, 0, 0))
hapi.rect(100, 10, size, size)
hapi.fill((0, 0, 255))
hapi.rect(10, 100, size, size)
hapi.flip_display()
hapi.event_loop()
pygame.quit()
docs
coming soon ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hooman-0.1.6.tar.gz
(6.1 kB
view hashes)