top of page

Label (PE.Label)

PE.Label.Image

make an image that you can put on a surface

​

class usage:

make an image.

Image.__init__(self, img: pygame.Surface, size=(100, 100), pos=(0, 0), rot=0, color=(0, 0, 0, 0))

function actions:

initialize the class 

​

parameters:

img - the image to use (pygame.Surface)

size - the image size (vector2 like)

pos - the image position (vector2 like)

rot - the image rotation (int)

color - the image tint (color4 like)

​

Image.show(self, workspace: pygame.Surface)

function actions:

puts the image on a surface

​

parameters:

workspace - the surface to put the image on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

Image.set_variables(self, img=None, size=None, pos=None, rot=None, color=None)

function actions:

change the image initial parameters without creating new or setting every parameter from scratch. None mean 'do not change'

​

parameters:

img - the image to use (pygame.Surface)

size - the image size (vector2 like)

pos - the image position (vector2 like)

rot - the image rotation (int)

color - the image tint (color4 like)

PE.Label.TextLabel

make a text label that you can put on a surface

 

class usage:

write a text on the screen

TextLabel.__init__(self, text: str, size=10, color=(0, 0, 0), pos=(0, 0), dir=0, font='freesansbold.ttf', background_color=(255, 255, 255, 0), rotation=0)

function actions:

initialize the class 

​

parameters:

text- the text to display (str)

size - the text height (int)

pos - the text position (vector2 like)

rotation - the text label rotation (int)

color - the itext color (color3 like)

dir - 0: left to right, 1: center the text (known bug) (0 or 1)

font - the font file to use (path like string)

background_color - the color of the background of the text (color4 like)

​

TextLabel.show(self, workspace: pygame.Surface)

function actions:

put the text on a surface

​

parameters:

workspace - the surface to put the text on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

TextLabel.set_variables(self, text=None, size=None, color=None, pos=None, dir=None, font=None, background_color=None, rotation=None)

function actions:

change the text label initial parameters without creating new or setting every parameter from scratch. None mean 'do not change'

parameters:

text- the text to display (str)

size - the text height (int)

pos - the image position (vector2 like)

rotation - the image rotation (int)

color - the image tint (color3 like)

dir - 0: left to right, 1: center the text (known bug) (0 or 1)

font - the font file to use (path like string)

background_color - the color of the background of the text (color4 like)

PE.Label.LoadingBar​

make a loading bar

 

class usage:

show the user the loading progress

LoadingBar.__init__(self, max_num: float, pos: pygame.Vector2, size: pygame.Vector2, color: pygame.Color, back_color: pygame.Color, text_color: pygame.Color, border: int, font='freesansbold.ttf', starting_text="")

function actions:

initialize the class 

​

parameters:

max_num - the maximum number to load (float/int)

size - the loading bar size (vector2 like)

pos - the loading bar position (vector2 like)

color - the color of the bar progress (color3 like)

border - the width of the bar border (int)

font - the font file to use (path like string)

back_color - the color of the border (color3 like)

text_color - the text color (color3 like)

starting_text - the initial text (str)

​

LoadingBar.show(self, surf: pygame.Surface)

function actions:

put the loading bar on a surface

​

parameters:

surf - the surface to put the loading bar on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

LoadingBar.change_value(self, value: int, text="")

function actions:

add progress to the loading bar.

​

parameters:

value - the amount of progress made (int/float)

text - the text to display on the loading bar, can be used in order to tell the user what progress done in the last progress update (str)

​

LoadingBar.change_variables(self, max_num=None, pos=None, size=None, color=None, back_color=None, text_color=None, border=None, font=None)

function actions:

change the loading bar initial parameters without creating new or setting every parameter from scratch. None mean 'do not change'

​

parameters:

max_num - the maximum number to load (float/int)

size - the loading bar size (vector2 like)

pos - the loading bar position (vector2 like)

color - the color of the bar progress (color3 like)

border - the width of the bar border (int)

font - the font file to use (path like string)

back_color - the color of the border (color3 like)

text_color - the text color (color3 like)

PE.Label.Slider​

make a slider. can be used in order to take numeric input.

 

class usage:

make a slider

Slider.__init__(self, pos: pygame.math.Vector2, size: pygame.math.Vector2, num_min=0, num_max=10, slider_image=None, back_color=(255, 255, 255, 0), slider_color=(0, 0, 0), hover_color=(200, 200, 200), drag_color=(100, 100, 100))

function actions:

initialize the class 

​

parameters:

num_max - the maximum number of the slider (int)

num_min - the minimum number of the slider (int)

size - the slider size (vector2 like)

pos - the slider position (vector2 like)

font - the font file to use (path like string)

back_color - the color of the background of the slider (color4 like)

slider_color - the regular slider color (color3 like)

hover_color - the slider color when the mouse pointer hover the slider (color3 like)

drag_color - the slider color when the mouse pointer drag the slider (color3 like)

slider_image - image to replace the circle with (None/pygame.Surface)

Slider.show(self, workspace: pygame.Surface)

function actions:

put the slider on a surface and calculate current value

​

parameters:

workspace - the surface to put the slider on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

Slider.change_variables(self, pos=None, size=None, num_min=None, num_max=None, slider_image=0, back_color=None, slider_color=None, hover_color=None, drag_color=None)

function actions:

change the slider initial parameters without creating new or setting every parameter from scratch. None mean 'do not change'

​

parameters:

num_max - the maximum number of the slider (int)

num_min - the minimum number of the slider (int)

size - the slider size (vector2 like)

pos - the slider position (vector2 like)

font - the font file to use (path like string)

back_color - the color of the background of the slider (color4 like)

slider_color - the regular slider color (color3 like)

hover_color - the slider color when the mouse pointer hover the slider (color3 like)

drag_color - the slider color when the mouse pointer drag the slider (color3 like)

slider_image - image to replace the circle with (None/pygame.Surface)

PE.Label.Tick​

make a tick label. can be used in order to take boolean input.

 

class usage:

make a tick label

Tick.__init__(self, pos: pygame.Vector2, size: pygame.Vector2, color=(200, 200, 200), hover_color=(100, 100, 100, 100), ticked_color=(0, 255, 150), tick_color=(255, 255, 255))

function actions:

initialize the class 

​

parameters:

size - the tick label size (vector2 like)

pos - the tick label position (vector2 like)

color - the regular color of the tick label (color3 like)

font - the font file to use (path like string)

hover_color - the color of the tick label when the mouse pointer hovers the tick label (color4 like)

ticked_color - the tick label color when the tick label is ticked (color3 like)

tick_color - the color of the tick itself (the "X" text when ticked) (color3 like)​

Tick.show(self, workspace: pygame.Surface)

function actions:

put the tick label on a surface

​

parameters:

workspace - the surface to put the tick label on (pygame.Surface)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

Tick.__bool__(self)

function actions:

check if the tick is ticked and return the value

​

​

recommended place in script:

inside an if statement (for example:

if Tick:

    print("the tick label is ticked!")

)

PE.Label.TexInput

make an text input label. can be used in order to take a text (string) input.

 

class usage:

make a text input label

TextInput.__init__(self, size=(100, 32), pos=(200, 200), box_text="Enter text here:", col_active=(200, 200, 200), col_passive=(100, 100, 100), col_active_txt=None, col_passive_txt=None)

function actions:

initialize the class 

​

parameters:

size - the text input label size (vector2 like)

pos - the text input label position (vector2 like)

box_text - text to display when there is no input (str)

col_active - the color of the label background when the label is selected (color3 like)

col_passive - the color of the label background when the label is not selected (color3 like)

col_active_txt - the color of the text when the label is selected. set to None in order to make it negative then regular (color3 like/None)

col_passive_txt - the color of the text when the label is not selected. set to None in order to make it negative then regular (color3 like/None)

​

InputLabel.show(self, workspace: pygame.Surface, events)

function actions:

put the input label on a surface and get user input.

​

parameters:

workspace - the surface to put the tick label on (pygame.Surface)

events - pe events (will be automated soon, probably next update) (PE.last_events)

​

​

recommended place in script:

in the render zone (between the frame fill and the frame update)

PE.Label.init(screen_size_)

automated function, updates global data

​

function actions:

update render resolution

​

function usage:

used by PE.init() function to update render resolution for gifs.

​

parameters:

screen_size_ - new render resolution

PE.Label.fast_image(workspace, img: pygame.surface.Surface, size=(100, 100), pos=(0, 0), rot=0, color=(0, 0, 0, 0))

takes more CPU power but less RAM storage. best use for automated images, such as for loops or tiled games.

​

function actions:

put an image on a surface

​

function usage:

dynamic amount of images, simple images.

​

parameters:

workspace - surface to put the image on (pygame.Surface)

img - the image source (pygame.Surface)

size - the image size (vector2 like)

pos - the image position (vector2 like)

rot - the image rotation (int)

color - the image tint (color4 like)​

PE.Label.fast_text(workspace, text: str, size=10, color=(0, 0, 0), pos=(0, 0), dir=0, font='freesansbold.ttf')

takes more CPU power but less RAM storage. best use for automated text labels, such as for loops.

​

function actions:

put a text on a surface

​

function usage:

dynamic amount of text labels, simple text labels.

​

parameters:

workspace - surface to put the text on (pygame.Surface)

text - the text (str)

size - the text height (int)

pos - the text position (vector2 like)

font - the font file (path like string)

color - the text color (color3 like)

Powered and secured by Wix © 2035

bottom of page