Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. import pygame
  2.  
  3. from multiprocessing import Process
  4. lines = [chr(i) for i in range(33, 255)]
  5. def main():
  6.     from pathlib import Path
  7.     path = '/'.join(str(__file__).split('/')[:-2])
  8.     pygame.init()
  9.     size = (700, 500)
  10.     screen = pygame.display.set_mode(size, pygame.RESIZABLE)
  11.     pygame.display.set_caption("PyTerm")
  12.     run = True
  13.  
  14.     roboto = pygame.font.SysFont('FixedSys', 15)
  15.  
  16.     h = 500
  17.     w = 700
  18.  
  19.     lines = [chr(i) for i in range(33, 255)]
  20.  
  21.     line = 0
  22.  
  23.     def CreateWindow(width, height):
  24.         global screen, h, w
  25.         '''Updates the window width and height '''
  26.         screen = pygame.display.set_mode((width, height), pygame.RESIZABLE)
  27.         h = height
  28.         w = width
  29.         screen.fill((0, 0, 0))
  30.  
  31.  
  32.     d = pygame.Surface((700, 700))
  33.  
  34.     while run:
  35.         pygame.time.delay(10)
  36.         screen.fill((0, 0, 0))
  37.         for i in range(len(lines) - line):
  38.             screen.blit(roboto.render(lines[i + line], True, pygame.Color('#ffffff')), (10, i * 15 + 10))
  39.  
  40.         pygame.display.update()
  41.         for e in pygame.event.get():
  42.             if e.type == pygame.QUIT:
  43.                 run = False
  44.             elif e.type == pygame.VIDEORESIZE:
  45.                 CreateWindow(e.w, e.h)
  46.             if e.type == pygame.MOUSEBUTTONDOWN:
  47.                 if e.button == 5 and line < len(lines) - 1:
  48.                     line += 2
  49.                 elif e.button == 4 and line > 0:
  50.                     line -= 2
  51.  
  52.  
  53.     pygame.quit()
  54.  
  55. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement