0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【3】【python/pygame】画像を表示する

Posted at

以下のコード
※.pyファイルが該当画像と同一フォルダにあること

# 1. ゲームの準備をする
import pygame as pg, sys
pg.init()
screen = pg.display.set_mode((800, 600))
img1 = pg.image.load("car.png")
img1 = pg.transform.scale(img1, (50,50))

# 2.この下をずっとループする
while True:

    # 3. 画面を初期化する
    screen.fill(pg.Color("WHITE"))

    # 5.絵を描いたり、判別したりする
    screen.blit(img1, (100, 100))

    # 6.画面を更新する
    pg.display.update()

    # 7.閉じるボタンが押されたら、終了する
    for event in pg.event.get():
        if event.type == pg.QUIT:
            pg.quit()
            sys.exit()

以下が結果です。
test21_3.jpg

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?