forked from SHZ66/Skeet-Shooting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
40 lines (35 loc) · 1.11 KB
/
example.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
37
38
39
40
# EzText example
from pygame.locals import *
import pygame, sys, eztext
def main():
# initialize pygame
pygame.init()
# create the screen
screen = pygame.display.set_mode((640,240))
# fill the screen w/ white
screen.fill((255,255,255))
# here is the magic: making the text input
# create an input with a max length of 45,
# and a red color and a prompt saying 'type here: '
txtbx = eztext.Input(maxlength=45, color=(255,0,0), prompt='type here: ')
# create the pygame clock
clock = pygame.time.Clock()
# main loop!
while 1:
# make sure the program is running at 30 fps
clock.tick(30)
# events for txtbx
events = pygame.event.get()
# process other events
for event in events:
# close it x button si pressed
if event.type == QUIT: return
# clear the screen
screen.fill((255,255,255))
# update txtbx
txtbx.update(events)
# blit txtbx on the sceen
txtbx.draw(screen)
# refresh the display
pygame.display.flip()
if __name__ == '__main__': main()