set_screen(screen)
Set the default surface display for all elements that will be created after this call.
get_screen()
Get the default surface display for elements that will be created after this call.
init(screen, theme=None)
Initialize the display surface for the elements that will be created and set the default theme.
Mandatory arguments
screen : Pygame surface used as default display surface for the element to draw.
Optionnal arguments
theme : a thorpy theme function (e.g. thorpy.theme_classic). If no theme is passed, 'human' theme is used.
fn(fn)
Refers a filename from Thorpy location on the disk. Mostly used for the examples, you should not use it.
call_before_gui(func)
Sets the function to call by default before gui is drawn on screen, when using Thorpy's Updater object.
If you integrate Thorpy element into your own loop, this must probably won't affect your code.
set_waiting_bar(text_or_bar)
Sets the global waiting bar that will be shown to the user when he has to wait.
text_or_bar : either a string or a WaitingBar. If it's a string, then Thorpy automatically
generates a WaitingBar instance with this string as the text.
refresh_waiting_bar()
Function to call each time the waiting bar has to be updated and drawn to the screen.
pause()
Pauses the application until user press a key.
set_style_attr(attr, value, states=None, exceptions_cls=None, only_to_cls=None)
Set a given style attribute for a group of element classes.
Mandatory arguments
attr : (str) the name of the attribute.
value : the value of the attribute.
Optionnal arguments
states : either a string specifying the state concerned (e.g. 'hover') or 'all' for all states,
or a sequence of states (e.g. ['hover', 'pressed']).
exception_cls : a sequence of classes that are NOT concerned by the modification.
only_to_cls : a sequence of classes to which retrain the application of the modification.
get_theme_bck_color()
Returns current Button theme color.
get_theme_main_bck_color()
Returns current Button theme color.
The difference with get_theme_bck_color is that the latter can return gradient color, whereas
get_theme_main_bck_color necessarily returns either a single RGB tuple, a single RGBA tuple or None.
set_default_font(font_name, font_size)
Set the default font for all thorpy elements.
This function must be called before thorpy.init()
font_name : a string with the name or path of the font, or a list of font names.
In the latter case, the first existing font in the user system will be chosen.
font_size : integer font size.
get_default_font(style=None)
Get the font used by default if an element is created now.
style : reference style. thorpy.TextStyle by default.
get_text_height(cls=None)
Returns the height in pixels of the current default style for texts. This is a different value
than the height of an element including the text, since elements typically include margins.
cls : class of the element used as reference. thorpy.Text by default.
get_text_size(text, cls=None)
Returns the size in pixels of the current default style. This is a different value
than the size of an element including the text, since elements typically include margins.
text : the text for which you want to know the size.
cls : class of the element used as reference. thorpy.Text by default.