@ -5,9 +5,9 @@ import pygame.camera
from pygame import *
from pygame import *
def render_text_line ( image, color, font, text , pos = ( 0 , 0 ) ) :
def render_text_line ( r image, r color, r font, text , pos = ( 0 , 0 ) ) :
render_text = font. render ( text , 1 , color)
render_text = r font. render ( text , 1 , r color)
image. blit ( render_text , pos )
r image. blit ( render_text , pos )
class Screen :
class Screen :
@ -20,7 +20,8 @@ class Screen:
self . screen = pygame . display . set_mode ( self . size )
self . screen = pygame . display . set_mode ( self . size )
pygame . display . set_caption ( title )
pygame . display . set_caption ( title )
def refresh ( self , rectangles = None ) :
@staticmethod
def refresh ( rectangles = None ) :
pygame . display . update ( rectangles )
pygame . display . update ( rectangles )
def toggle_fullscreen ( self ) :
def toggle_fullscreen ( self ) :
@ -45,12 +46,12 @@ class List(pygame.sprite.Sprite):
self . rect = self . image . get_rect ( )
self . rect = self . image . get_rect ( )
self . rect . topleft = position
self . rect . topleft = position
self . font = pygame . font . SysFont ( ' Arial ' , 25 )
self . font = pygame . font . SysFont ( ' Arial ' , 25 )
self . di ct = { }
self . di splay_di ct = { }
self . updated = True
self . updated = True
self . txtsize = self . font . size ( ' __||__ ' )
self . txtsize = self . font . size ( ' __||__ ' )
def set_dict ( self , dict) :
def set_dict ( self , disp dict) :
self . di ct = dict
self . di splay_dict = disp dict
self . updated = True
self . updated = True
def update ( self ) :
def update ( self ) :
@ -58,8 +59,8 @@ class List(pygame.sprite.Sprite):
height = 0
height = 0
self . image . fill ( ( 0 , 0 , 0 ) )
self . image . fill ( ( 0 , 0 , 0 ) )
for key in self . dict. keys ( ) :
for dict key in self . display_ dict. keys ( ) :
line = ' {} : {} ' . format ( key, self . di ct[ key] )
line = ' {} : {} ' . format ( dict key, self . di splay_di ct[ dict key] )
render_text_line ( self . image , ( 255 , 255 , 255 ) , self . font , line , ( 0 , height ) )
render_text_line ( self . image , ( 255 , 255 , 255 ) , self . font , line , ( 0 , height ) )
height + = self . txtsize [ 1 ]
height + = self . txtsize [ 1 ]