- This Class lets you write text at the blinking cursor.
- Wraps text to the next line if it exceeds the max_width.
- Enter, Delete, Home, End, Page Up and Page Down key works.
- Cursor can be moved using arrow keys or click on character to jump directly.
- Scrolling using mouse or scroll bar.
- Text Selection using mouse.
- Cut, Copy, Paste and Select all using shortcut.
- Ctrl and Shift shortcut works.
- It works just like you expect.
Its very simple to use this module. Create an object of the Class and then feed the update()
with pygame-events.
- It will create surfaces of each line and store it in list only when any changes are made in the
input_string
for efficient rendering. List can be get usingget_surface()
. - Then call the
render()
. - If you don't want the text object to be updated with events.
- Pass
False
toupdate()
. - It will not take any input and it will not render cursor too indicating its inactive.
- Pass
Some part of code is borrowed from Pygame Text Input under the MIT license.