Wiki

Clone wiki

pypong-clock / Useful Settings to Control the Display

There are a number of different settings that you can change to modify the appearance of the pong-clock.

The following settings are found at the top of the pypong-clock.py file.

RESOLUTION = (896, 416)         # This is the resolution of the 7" TFT screen change to match your display.
WHITE = (255, 255, 255)         # This is the RGB color of the paddle and playfield divider
BLACK = (0, 0, 0)               # This is the RGB color of the playfield
PADDLE_HEIGHT = 60              # This is the height of the paddle in pixels
PADDLE_WIDTH = 14               # This is the width of the paddle in pixels
BALL_WIDTH = 28                 # This and the next one control the height and width of the ball
BALL_HEIGHT = 28
PADDLE_GUTTER_OFFSET = 18   # Offset for the paddles
CENTER_DIVIDER_SIZE = 10    # Size of the squares that divide the playing area in half
FIELD_EDGE_WIDTH = 14       # Edging on the top and bottom playing area
FIELD_EDGE_HEIGHT = 4       # Height of edging
FIELD_EDGE_OFFSET = 8       # Offset between the display surface edge and the edging

The height of the score display is controlled in the constructor for the scoredisplay object. To change the height and width of the score change the values in the tuple that's passed in the scoredisplay constructor. In the following two lines the value of (100, 180) is being passed as the width and height of the score. The code is found at line 82 of the pypong-clock.py file.

    right_score_display = ScoreDisplay((RESOLUTION[0] / 2 + 18, 20, 30, 50), (100, 180), 00, 'right')
    left_score_display = ScoreDisplay((RESOLUTION[0] / 2 - 18, 20, 60, 100), (100, 180), 00, 'left', True)

Updated