Skip to content

A module for text input in pygame. It supports wrapping, key shortcuts and selection of text.

License

Notifications You must be signed in to change notification settings

YashJogani/pygame-textinput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Pygame TextBox Input Module

Features

  • 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.

Using the Module

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 using get_surface().
  • Then call the render().
  • If you don't want the text object to be updated with events.
    • Pass False to update().
    • It will not take any input and it will not render cursor too indicating its inactive.

Some part of code is borrowed from Pygame Text Input under the MIT license.

Releases

No releases published

Packages

No packages published

Languages