Textbox

CactusGUI element for making textboxes.

Example Code:


gui.makeTextbox('myTextbox')
gui['myTextbox'].style(owner='main', top=50, left=50)

Attributes:

Textbox - Specific Type Attributes:
Attribute Datatype Comments
font pygame.font.Font Font to use
text string Text to display in textbox before the user changes it. Defaults to blank.
color color (R,G,B) Color of the text
background_color color (R,G,B)  
text_padding int  
border_color color (R,G,B)  
border_topleft_color color (R,G,B)  
border_bottomright_color color (R,G,B)  
border_top_color color (R,G,B)  
border_left_color color (R,G,B)  
border_bottom_color color (R,G,B)  
border_right_color color (R,G,B)  
height int  
width int  
top int  
bottom int  
left int  
right int  
caret_at int Which char in the textbox the caret is at. (Actually in front of)
offset_left int  
caretmap object Stores the pixel size of each char so that the caret will be in the correct position
maxlength int Sets maximum length (Number of characters) that are allowed in the textbox

Must be a positive number
GUI Primary Attributes:
Attribute Datatype Comments
name string Identifies the element inside the GUI
owner string Name of the element that "owns" the current element
type string The specific kind of element - ex: Textbox, Button, Image, State, etc.
z_order int Determines the layering order of the element when GUI elements with the same owner are rendered. The element with the highest z-order is layered on top. Can use both positive and negative numbers.
visible bool If visible is True then the element is displayed, if False then the element will not display. Child-elements that the element owns will still be rendered. Defaults to True.
show bool If False then the element's child-elements will not be rendered to the screen. Defaults to True.
use_hover bool Defaults to True for some elements. Tells the GUI's listener object to listen for events from the current element:
onHover, onUnhover
use_click bool Defaults to True for some elements. Tells the GUI's listener object to listen for events from the current element:
onMousedown, onRightMousedown, onAnyMousedown, onMouseup, onRightMouseup, onAnyMouseup, onClick, onRightClick, onAnyClick, onBlur, onDeactivate

onActivate requires both use_click and use_active
onFocus requires both use_click and use_focus
use_scroll bool Defaults to True for some elements. Tells the GUI's listener object to listen for events from the current element:
onCenterMousedown, onCenterMouseup, onScrollUp, onScrollDown
use_active bool Defaults to True for some elements.
onActivate requires both use_click and use_active
use_focus bool Defaults to True for some elements.
onFocus requires both use_click and use_focus