<< Previous TopicReturn to Index  

my first graphics program in python (2009)

November 30 2017 at 8:36 PM
easylangs  (Login easylangs)
Python and FIG Forum

 
# 2009 mennonite
# public domain
import pygame
import sys
import random
import time
pygame.init() ; game = pygame.display.set_mode([1278, 770])
ink = 32 ; kpp = 0
bcx, bcy, bcz, bx, by = 0, 0, 0, 100, 100
xy = [] ; cxy = 0
while kpp == 0:
    bcz = bcz + ink
    if bcz > 255: bcz = 0 ; bcy = bcy + ink
    if bcy > 255: bcy = 0 ; bcx = bcx + ink
    if bcx > 255: bcx = 0 ; bcy = 0 ; bcz = 0
    bx = bx + 20
    kp = pygame.key.get_pressed() ; kpp = kp[pygame.K_ESCAPE]
    if bx > 980:
        bx = 100 ; by = by + 20
    if by > 500:
        by = 100 ; bx = 100 ; pygame.display.update() ; cxy = 0
        pygame.event.pump() ; time.sleep(0.1)
    try:
        cb = xy[cxy]
    except:
        if len(xy) < 1000: xy = xy + [(random.randint(0, 8) == 0)]
    if xy[cxy] == 1:
        pygame.draw.rect(game, (bcx, bcy, bcz), [bx, by, 80, 80 - by / 10], 4)
    cxy = cxy + 1


nothing fancy, was just getting a taste:

pn9Z81Z.png

ive talked about how i feel about pygame vs basic before, its probably similar to how you feel about it. though as graphics libraries in python go, its probably the most useful for its level of friendliness-- vs. other libraries.

 
 Respond to this message   
AuthorReply

Wise Guy
(Login The-Universe)
Admin

* 2009? It took you 8 years to make that? I'll stick to BASIC.

December 3 2017, 6:03 PM 

I could make that in QB in 5 years, easy, and I don't do graphics. I bet TheBOB could handle it even faster!

Pete :D


    
This message has been edited by easylangs on Dec 3, 2017 6:13 PM


 
 Respond to this message   
easylangs
(Login easylangs)
Python and FIG Forum

fixed!

December 3 2017, 6:17 PM 

ordinarily i wouldnt mess with one of your posts, but the joke didnt make any sense with the number you used.

explain it (or just insist) and i will change it back so you dont have to.

 
 Respond to this message   

Pete
(Login The-Universe)
Admin

Don't make me bring Steve into this...

December 6 2017, 10:13 AM 

Steve: Look at the date on your program (2009) and the date it was published, 2017. Now subtract 2009 from 2017 and we get 8. Eight years from the start of your program to completion. Also, Pete is just being a jackass.


 
 Respond to this message   
easylangs
(Login easylangs)
Python and FIG Forum

ive definitely missed part of the joke

December 6 2017, 4:52 PM 

for whatever reason, you said 18 years and i changed it to 8, because i was sure thats what you meant.

i also figured it was only fair to offer to change it back if you wanted, but i couldnt figure out how you couldve actually meant 18-- unless it was a tongue in cheek reference to a similar mistake.

theres always the logan basic method of doing math: he was counting on his fingers!

 
 Respond to this message   
 
  << Previous TopicReturn to Index  
 Copyright © 1999-2017 Network54. All rights reserved.   Terms of Use   Privacy Statement