codeskulptor_lib — some miscellaneous functions
(Version saved in CodeSkulptor https://py3.codeskulptor.org/#user305_SXBsmszNiUxIeoV.py .)
codeskulptor_lib module.
Some miscellaneous functions to help in CodeSkulptor.
Piece of SimpleGUICS2Pygame. https://bitbucket.org/OPiMedia/simpleguics2pygame
- license
GPLv3 — Copyright (C) 2013-2014, 2020 Olivier Pirson
- author
Olivier Pirson — http://www.opimedia.be/
- version
May 19, 2020
- SimpleGUICS2Pygame.codeskulptor_lib.__CODESKULPTOR_IS = None
Used to memoization by codeskulptor_is().
- SimpleGUICS2Pygame.codeskulptor_lib.__CODESKULPTOR_VERSION = None
Used to memoization by codeskulptor_version().
- SimpleGUICS2Pygame.codeskulptor_lib.assert_position(position: Union[int, float], non_negative: bool = False, non_zero: bool = False) None [source]
Assertions to check valid position.
If non_negative then each int or float must be >= 0.
If non_zero then each int or float must be != 0.
- Parameters
position – (int or float, int or float) or [int or float, int or float]
non_negative – bool
- SimpleGUICS2Pygame.codeskulptor_lib.codeskulptor_is() bool [source]
If run in CodeSkulptor environment then return True, else return False.
- Returns
bool
- SimpleGUICS2Pygame.codeskulptor_lib.codeskulptor_version() Union[bool, int] [source]
If run in CodeSkulptor environment then return 2 if CodeSkulptor or 3 if CodeSkulptor3 else return False.
- Returns
False, 2 or 3
- SimpleGUICS2Pygame.codeskulptor_lib.hex2(n: int, uppercase: bool = True) str [source]
Return 2 characters corresponding to the hexadecimal representation of n.
- Parameters
n – 0 <= int < 256
uppercase – bool
- Returns
str (length == 2)
- SimpleGUICS2Pygame.codeskulptor_lib.hex_fig(n: int, uppercase: bool = True) str [source]
Return the hexadecimal figure of n.
- Parameters
n – 0 <= int < 16
uppercase – bool
- Returns
str (one character from 0123456789ABCDEF or 0123456789abcdef)
- SimpleGUICS2Pygame.codeskulptor_lib.hsl(hue: Union[int, float], saturation: Union[int, float], lightness: Union[int, float]) str [source]
Return the string HTML representation of the color in ‘hsl(hue, lightness, saturation)’ format.
- Parameters
hue – float or int
saturation – 0 <= float or int <= 100
lightness – 0 <= float or int <= 100
- Returns
str
- SimpleGUICS2Pygame.codeskulptor_lib.hsla(hue: Union[int, float], saturation: Union[int, float], lightness: Union[int, float], alpha: Union[int, float] = 1) str [source]
Return the string HTML representation of the color in ‘hsla(hue, lightness, saturation, alpha)’ format.
- Parameters
hue – float or int
saturation – 0 <= float or int <= 100
lightness – 0 <= float or int <= 100
alpha – 0 <= float or int <= 1
- Returns
str
- SimpleGUICS2Pygame.codeskulptor_lib.rgb(red: int, green: int, blue: int) str [source]
Return the string HTML representation of the color in ‘rgb(red, blue, green)’ format.
- Parameters
red – 0 <= int <= 255
green – 0 <= int <= 255
blue – 0 <= int <= 255
- Returns
str
- SimpleGUICS2Pygame.codeskulptor_lib.rgba(red: int, green: int, blue: int, alpha: Union[int, float] = 1) str [source]
Return the string HTML representation of the color in ‘rgba(red, blue, green, alpha)’ format.
- Parameters
red – 0 <= int <= 255
green – 0 <= int <= 255
blue – 0 <= int <= 255
alpha – 0 <= float or int <= 1
- Returns
str
[source]