[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple graphic library for beginners

On 01/10/2018 01:13 PM, bartc wrote:
> I couldn't see anything obviously simple there. A lot seems to do with 
> interaction which is always much more complicated than just drawing stuff.

Yes the link didn't have the simple examples I hoped for.  How's this:
import pygame
import time

screen = pygame.display.set_mode((1024, 768) )
red = (255,0,0)
green = (0,255,0)

screen.fill( (255,255,255) )
pygame.draw.lines(screen, red, False, ((0,0),(100,100)))
pygame.draw.lines(screen, green, False, ((0,100),(100,0)))


PyGame has other primitives like circles, ellipses, etc.  Much like the
old BASIC graphics primitives.

> 'Turtle' will do it (assuming there's a way of drawing things without 
> having to watch an actual turtle symbol crawling around the screen).

Yes I think it can.

> One simple library of my own (not for Python) would use one function 
> call to create a window, and another to draw an element (say, a box) 
> within that window. (Plus a third to keep it on the screen otherwise it 
> will disappear when the program terminates.)

Are you thinking of sprites?

> The only way to get it simpler than that is where the display window is 
> always present (like some old Basics).

This is sort of similar to PyGame's concepts.