textbox module¶
- class ui.textbox.Textbox(screen, x, y, h, w, color, borderColor=(0, 0, 0), textColor=(255, 255, 255), fontSize=14)¶
Bases:
object
Textbox class
- Parameters
screen (pygame.Surface) -- surface to draw onto
x (int) -- x coordinate of the textbox
y (int) -- y coordinate of the textbox
h (int) -- height of the textbox
w (int) -- width of the function
color (tupple : (r g, b) with rgb spanning from 0 to 255) -- color of the textbox (background)
borderColor (tupple : (r g, b) with rgb spanning from 0 to 255) -- color of the border
textColor (tupple : (r g, b) with rgb spanning from 0 to 255) -- color fo the text inside the textbox
fontSize (int) -- size of the font
- draw()¶
draw the textbox
- getText()¶
- Returns
the text that was typed inside the textbox
- Return type
string
- listen(event)¶
listen for events and manage the textbox (updating and drawing text inside it ...) dont forget to update the surface / screen after
- Parameters
event -- event to listen to (only one event)
- Return type
pygame.Event