Skip to content

Commit 7cd3b20

Browse files
committed
improved readme
1 parent 92b1e11 commit 7cd3b20

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ while True:
3939
screen.fill((225, 225, 225))
4040

4141
events = pygame.event.get()
42-
for event in events:
43-
if event.type == pygame.QUIT:
44-
exit()
4542

4643
# Feed it with events every frame
4744
textinput.update(events)
4845
# Blit its surface onto the screen
4946
screen.blit(textinput.surface, (10, 10))
5047

48+
for event in events:
49+
if event.type == pygame.QUIT:
50+
exit()
51+
5152
pygame.display.update()
5253
clock.tick(30)
5354
```
@@ -94,7 +95,7 @@ Like `TextInputVisualizer`, you feed its `update` method all events received by
9495
Argument | Description
9596
---|---
9697
initial | The initial value (text)
97-
validator | A function taking a `string` and returning a `bool`. Every time the input value is modified, this function is called; if the function returns `True`, the input is accepted, otherwise it is ignored.
98+
validator | A function taking a `string` and returning a `bool`. Every time an input modifies the value, this function is called with the modified value as an argument; if the function returns `True`, the input is accepted, otherwise the input is ignored.
9899

99100
So say you want to only allow input to up to 5 letters, you could do that with
100101

0 commit comments

Comments
 (0)