24
loading...
This website collects cookies to deliver better user experience
import pygame
pygame.init()
display = pygame.display.set_mode((1280, 720))
display = pygame.display.set_mode((1280, 720) DOUBLEBUF|OPENGL)
clock = pygame.time.Clock()
display.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
pygame.QUIT
pygame.ACTIVEEVENT
pygame.KEYDOWN
pygame.KEYUP
pygame.MOUSEMOTION
pygame.MOUSEBUTTONUP
pygame.MOUSEBUTTONDOWN
pygame.JOYAXISMOTION
pygame.JOYBALLMOTION
pygame.JOYHATMOTION
pygame.JOYBUTTONUP
pygame.JOYBUTTONDOWN
pygame.VIDEOEXPOSE
pygame.VIDEORESIZE
pygame.USEREVENT
pygame.display.update()
pygame.display.flip()
clock.tick(60)
import pygame
pygame.init()
display = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
while True:
display.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
pygame.display.flip()
clock.tick(60)
import pygame
pygame.init()
display = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
Font = pygame.font.SysFont("Arial", 30)
while True:
sampleText = Font.render("Some Text", True, (0, 0, 0))
display.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
display.blit(sampleText, (0, 0))
clock.tick(60)
pygame.display.update()
scroll = 0
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
if event.type == pygame.KEYDOWN:
if event.type == pygame.K_DOWN:
scroll += 5
elif event.key == pygame.K_UP:
scroll -= 5
display.blit(sampleText, (0, 0+scroll))
if scroll <= 0:
scroll = 0
elif scroll >= 100:
scroll = 100
Rect = pygame.Rect(1270, 5+scroll, 5, (720-(130/820)*720))
pygame.draw.rect(display, (255, 0, 0), Rect)
import pygame
pygame.init()
display = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
scroll = 0
Font = pygame.font.SysFont("Arial", 30)
while True:
Rect = pygame.Rect(1270, 5+scroll, 5, (720-(130/820)*720))
sampleText = Font.render("Some Text", True, (0, 0, 0))
display.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
if event.type == pygame.KEYDOWN:
if event.type == pygame.K_DOWN:
scroll += 5
elif event.key == pygame.K_UP:
scroll -= 5
if scroll <= 0:
scroll = 0
elif scroll >= 100:
scroll = 100
display.blit(sampleText, (0, 0+scroll))
pygame.draw.rect(display, (255, 0, 0), Rect)
clock.tick(60)
pygame.display.update()
Counter = 0
Points = []
Poins.append((Counter, ExternalData[Counter]))
pygame.draw.aalines(display, (255,0,0), False, Points)
Counter += 1
if Counter >= 2:
import pygame
pygame.init()
display = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
Counter = 0
Points = []
while True:
Points.append((Counter, ExternalData[Counter]))
display.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
if Counter >= 2:
pygame.draw.aalines(display, (255,0,0), False, Points)
pygame.display.flip()
clock.tick(60)
Counter += 1
if Counter >= 100:
Counter = 0
pip install Python-Pycraft
This edition, and future editions of this series will not be including images of code, although this can look nicer and syntax highlighting can be helpful, having code written out here makes it friendly for those in the development community who have sight issues (like myself), or if you want to have this article read to you!