Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug and edit size of screen #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Show image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pygame
import os

pygame.init()

ASSETS_PATH = './'
FPS = 60
clock = pygame.time.Clock()

# Create Screen
x_screen = 1000
y_screen = 800
screen = pygame.display.set_mode((x_screen, y_screen))
screen.fill((255,255,255))

# Title of screen
pygame.display.set_caption("Wero - Wordle")

# Show image funtion
class image():
def __init__(self, image_list, x, y, width, height):
self.image_list = image_list
self.image = None
self.width = width
self.height = height
self.x = x
self.y = y
def load_image(self):
for image in self.image_list:
self.surface = pygame.image.load(os.path.join(ASSETS_PATH, image))
def draw_image(self):
self.image = self.surface
self.image = pygame.transform.scale(self.image, (self.width, self.height))
screen.blit(self.image, (self.x, self.y))
def draw_image(image_list, x, y, width, height):
images = image(image_list, x, y, width, height)
images.load_image()
images.draw_image()

# running game
exit = False
while not exit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit = True
draw_image(["example.png"], 100, 100, 500, 500)
pygame.display.update()
clock.tick(FPS)
pygame.quit()
11 changes: 8 additions & 3 deletions cua_so.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import pygame

pygame.init()

FPS = 60
clock = pygame.time.Clock()

# Create Screen
x_screen = 500
y_screen = 500
x_screen = 1000
y_screen = 800
screen = pygame.display.set_mode((x_screen, y_screen))
screen.fill((255,255,255))

Expand All @@ -30,4 +33,6 @@
#screen.blit(pygame.font.Font.render(font, "Wordle", 1, color),(x_namegame,y_namegame))
screen.blit(wordle, wordle.get_rect(center = (x_namegame - 55, 20)))
screen.blit(vietnam, vietnam.get_rect(center = (x_namegame + 55, 20)))
pygame.display.update()
pygame.display.update()
clock.tick(FPS)
pygame.quit()