sdl2.util - PySDL2 utilities.¶
...
-
sdl2.util.
sdl2_path
(*args)¶ Get the dnf_game base path.
-
class
sdl2.util.
Singleton
¶ Bases:
object
Restrict the instantiation of each class to one object.
Should be used as a metaclass of the singleton classes.
Example
- class SingletonJR(metaclass=Singleton)
- pass
-
sdl2.util.
get_cfg
(section, option, convert=False, path=None)¶ Interface for ConfigParser.
Parameters: Example
>>> get_cfg(section='MANAGER', option='SCREEN_WIDTH', convert=True) 1024
Returns: str (value of the cfg entry, if a match is found) None (if the option/key is not found)
-
sdl2.util.
iter_nested
(iterables)¶ Iterate over a iterable of depth one or two.
In both cases yield one item at a time.
Parameters: iterables (iterable) – a iterable or a iterable of iterables. Examples
>>> list(nested_or_not(((0, 0, 10, 10), (20, 20, 10, 10)))) [(0, 0, 10, 10), (20, 20, 10, 10)]
>>> list(nested_or_not((30, 30, 10, 10))) [(30, 30, 10, 10)]
# in both cases this would work: # for tup in nested_or_not(): # do something