From f1dba7705bdf1a8f270f533348ae310908111749 Mon Sep 17 00:00:00 2001 From: Junior Date: Wed, 5 Jun 2024 17:06:25 -0400 Subject: [PATCH] Lighten background color --- PyGame/Calculator/calc.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PyGame/Calculator/calc.py b/PyGame/Calculator/calc.py index f62f5fd..d88a6f9 100644 --- a/PyGame/Calculator/calc.py +++ b/PyGame/Calculator/calc.py @@ -20,6 +20,7 @@ float_precision = 1 yellow = (240, 240, 20) white = (255, 255, 255) black = (0, 0, 0) +background = (80, 80, 80) button_origin_x = 90 button_origin_y = 280 @@ -121,7 +122,7 @@ def flash_button(b): center_x = button_origin_x + (b.column * button_spacing) center_y = button_origin_y + (b.row * button_spacing) center = (center_x, center_y) - pygame.draw.circle(screen, black, center, button_radius, 4) + pygame.draw.circle(screen, background, center, button_radius, 4) pygame.draw.circle(screen, yellow, center, button_radius, 2) b.flashing = False @@ -144,6 +145,8 @@ pygame.display.set_caption('CheesyCalc') icon = pygame.image.load(os.path.join("img", "cheesy_icon_32x32.png")) icon.convert_alpha() pygame.display.set_icon(icon) +screen.fill(background) +pygame.display.flip() logo = pygame.image.load(os.path.join("img", "cheesy.png")) logo.convert_alpha() screen.blit(logo, (30, 20)) @@ -154,6 +157,7 @@ screen.blit(logo_text_1, (width // 2 - logo_text_1.get_width() // 2 + 80, 0)) screen.blit(logo_text_2, (width // 2 - logo_text_2.get_width() // 2 + 80, 45)) sevenseg_font = pygame.font.Font(os.path.join("font", "DSEG7Modern-Bold.ttf"), 60) draw_buttons() +pygame.display.flip() while True: for event in pygame.event.get(): @@ -232,11 +236,12 @@ while True: print(display_num_decimal) old_display_num_whole = display_num_whole old_display_num_decimal = display_num_decimal - pygame.draw.rect(screen, (0, 0, 0), pygame.Rect(12, 97, 576, 126)) - num_show = (num_float == False) + #pygame.draw.rect(screen, (0, 0, 0), pygame.Rect(12, 97, 576, 126)) + pygame.draw.rect(screen, black, pygame.Rect(10, 100, width - 20, 110)) + pygame.draw.rect(screen, yellow, pygame.Rect(10, 100, width - 20, 110), 2) text = sevenseg_font.render(display_num_whole + "." + display_num_decimal, True, white) - screen.blit(text, (580 - text.get_width(), 120)) - pygame.draw.rect(screen, yellow, pygame.Rect(10, 100, 580, 110), 2) + screen.blit(text, (width - 20 - text.get_width(), 120)) + #pygame.draw.rect(screen, yellow, pygame.Rect(10, 100, 580, 110), 2) for key, b in buttons.items(): if b.flashing == True and time.time() >= b.unflash_on: flash_button(b)