-
Notifications
You must be signed in to change notification settings - Fork 29
/
hello.py
37 lines (30 loc) · 1.09 KB
/
hello.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/env python
############################################################################
# File name : hello.py
# Purpose : A Small Demo Practice Hello World Prgram using Pygame API
# Usages : Displays Hello World In Visual Mode. Considered as the first step of learning pygame API
# Start date : 17/12/2011
# End date : 17/12/2011
# Author : Ankur Aggarwal
# License : GNU GPL v3 http://www.gnu.org/licenses/gpl.html
# Dependency: simple.jpg
############################################################################
#import modules
import pygame
from pygame.locals import *
from sys import exit
#initalizing variables (setting up the stage)
pygame.init()
screen=pygame.display.set_mode((640,480),0,24)
pygame.display.set_caption("Hello World")
create=pygame.font.SysFont("comicsansms",30)
f=create.render("Hello World",True,(0,0,0),(255,255,255))
img=pygame.image.load("simple.jpg").convert()
#main loop which displays the hello world in visual mode
while True:
for i in pygame.event.get():
if i.type==QUIT:
exit()
screen.blit(img,(0,0))
screen.blit(f,(200,200))
pygame.display.update()