forked from sd18spring/InteractiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.py
More file actions
33 lines (24 loc) · 781 Bytes
/
button.py
File metadata and controls
33 lines (24 loc) · 781 Bytes
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
from pygame.locals import *
import pygame
import pygame_textinput
import time
import math
if __name__ == '__main__':
textinput = pygame_textinput.TextInput()
pygame.init()
screen = pygame.display.set_mode((250,250))
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
print(event.pos)
if event.type == pygame.QUIT:
running = False
break
screen.fill(pygame.Color(28, 172, 229))
# Feed it with events every frame
textinput.update(pygame.event.get())
# Blit its surface onto the screen
screen.blit(textinput.get_surface(), (10, 10))
pygame.display.update()
pygame.quit()