BigSteve/PyGame/Calculator/calc.py

34 lines
1.2 KiB
Python

import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
import sys
pygame.init()
width = 600
height = 900
screen = pygame.display.set_mode((width, height))
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)
logo = pygame.image.load(os.path.join("img", "cheesy.png"))
logo.convert_alpha()
screen.blit(logo, (30, 20))
cheesy_font = pygame.font.Font(os.path.join("font", "Cheese.ttf"), 60)
logo_text_1 = cheesy_font.render("Cheesy", True, (240, 240, 20))
logo_text_2 = cheesy_font.render("Calculator", True, (240, 240, 20))
screen.blit(logo_text_1, (width // 2 - logo_text_1.get_width() // 2 + 80, -15))
screen.blit(logo_text_2, (width // 2 - logo_text_2.get_width() // 2 + 80, 30))
sevenseg_font = pygame.font.Font(os.path.join("font", "Seven Segment.ttf"), 120)
text = sevenseg_font.render("9378675309", True, (255, 255, 255))
screen.blit(text, (width // 2 - text.get_width() // 2, 100))
pygame.draw.rect(screen, (240, 240, 20), pygame.Rect(10, 95, 580, 130), 2)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.display.flip()