Mind.Imagination¶
Classes, methods and functions marked with * aren’t for usual cases, they are made to help to the rest of the library.
Part of library for Main Menu.
-
Mind.Imagination.
ARROWS
= [(273, 'up'), (274, 'down'), (276, 'left'), (275, 'right')]¶ List of keys (arrows) for Menu changing index.
-
Mind.Imagination.
HIT
= [(13, 'hit'), (32, 'hit')]¶ List of keys for Menu selecting option.
-
Mind.Imagination.
RETURN
= [(13, 'return')]¶ List of keys for input option return.
-
Mind.Imagination.
ch_image
(new_image)[source]¶ Returns function which changes pusher image.
Parameters: new_image (pygame.Surface) – new image for option Returns: function
-
Mind.Imagination.
ch_pos
(off)[source]¶ Returns function which changes pusher position.
Parameters: off (tuple of numbers) – x and y change Returns: function
-
Mind.Imagination.
ch_text
(new_text, error=True)[source]¶ Returns function which changes pusher text (only for text_pushers).
Parameters: - new_text (str) – new text for pusher
- error (bool) – if
True
raises error if pusher isn’t text_pusher
Returns: function
-
Mind.Imagination.
ch_color
(new_color, error=True)[source]¶ Returns function which changes pusher color (only for text_pushers).
Parameters: - new_color (color-like tuple) – new color for pusher
- error (bool) – if
True
raises error if pusher isn’t text_pusher
Returns: function
-
Mind.Imagination.
ch_font
(new_font, error=True)[source]¶ Returns function which changes pusher font (only for text_pushers).
Parameters: - new_font (pygame.font.Font) – font for puhser to be changed
- error (bool) – if
True
raises error if pusher isn’t text_pusher
Returns: function
-
Mind.Imagination.
reset
(im=True, pos=True)[source]¶ Returns function which resets pusher.
Parameters: - im (bool) – if
True
resets image - pos (bool) – if
True
resets position
Returns: function
- im (bool) – if
-
Mind.Imagination.
link
(place)[source]¶ Returns function which leads game to onother place.
Parameters: place ( PLACE
) – place for game current placeReturns: function
-
Mind.Imagination.
joined
(List)[source]¶ Returns function which executes all function in a given list.
Parameters: List (list) – list of all functions which will be executed Returns: function
-
Mind.Imagination.
set_printer
(printer)[source]¶ Sets default printer for print.
Parameters: printer – printer which will be default for print()
-
class
Mind.Imagination.
PLACE
(active=False)[source]¶ Bacis class for states of main menu.
Parameters: active (bool) – place activity
-
class
Mind.Imagination.
Game
(main_place)[source]¶ Bacis game class main menu.
Parameters: main_place – first place for game Adds menu to game.*
-
change
(new)[source]¶ Change game current place.
Parameters: new ( PLACE
) – new place which will be blitted
-
define
(**options)[source]¶ Defines options parameters for all menues.
Parameters: options – option parameters for all menues (see Main_menu
andoption
)
-
declare
(type_=None, **options)[source]¶ Defines menues parameters.
Parameters: - type (type) – type of all menues in game (None for will be defined later).
- options – menu parameters (see
Main_menu
)
-
get_from
(prior=False, **rest)[source]¶ - Returns menu from game combining previously defined and rest
- arguments.
Parameters: - prior (bool) – if
True
rest options are prefered otherwise previously defined are prefered. - rest – menu parameters which aren’t defined by
Game.declare()
Returns: menu or any other type defined by type argument
-
set_from
(prior=False, **rest)[source]¶ - Like
get_from()
but this function automatically sets - menu for game menu.
Parameters: - prior (bool) – if
True
rest options are prefered otherwise previously defined are prefered. - rest – menu parameters which aren’t defined by
Game.declare()
Returns: menu or any other type defined by type argument
- Like
-
class
Mind.Imagination.
Hyper_game
[source]¶ Game for easy places controlling.
Adds menu to game.*
Sets game current menu.
Parameters: menu ( Main_menu
) – Menu which will be blitted
-
class
Mind.Imagination.
Keyboard
(definer, flags=0)[source]¶ Bacis keyboard class.
Parameters: definer (list of tuples) – defines keyboard keys
Basic menu class.
Parameters: - places (
PLACE
or list ofPLACE
) – place/es on which will menu be blitted - x_distance (int) – x distance between each option
- y_distance (int) – y distance between each option
- options (
option
) – menu options - off (tuple of two ints) – how off menu is (on relation to the center of screen)
- off_type (str) – if ‘pixel’ off will be measured in pixels, if ‘percent’ (or ‘%’) off will be measured in percent of screen
- keyboard (
Keyboard
) – keyboard which will be used in menu
Adds new option to menu.
Parameters: - option (:py:class:option) – option which will be added to menu
- seted_option (bool) – if
True
menu index will be on that option
Should be executed on the end of options adding.
Defines options parameters.
Parameters: - type (type) – type of option
- options – arguments for options
- Returns option from menu combining previously defined and rest
- arguments.
Parameters: - prior (bool) – if
True
rest options are prefered otherwise previously defined are prefered. - rest – option parameters which aren’t defined by
Main_menu.define()
Returns: option or any other type defined by type argument
Sets option to menu.
Parameters: - seted_option (bool) – if
True
menu index will be on that option - prior (bool) – if
True
rest options are prefered otherwise previously defined are prefered - rest – option parameters which aren’t defined by
Main_menu.define()
- seted_option (bool) – if
Sets menu to given game.
Parameters: game ( Game
) – game which will be added to menu
Blits menu.
Returns game menu keyboard.
Returns: menu keyboard Return type: Keyboard
Locks menu index.*
Unlocks menu index.*
- places (
Returns menu which is vertical.
Parameters: - places (
PLACE
or list ofPLACE
) – place/es on which will menu be blitted - distance (int) – distance between each option
- options (
option
) – menu options - off (tuple of two ints) – how off menu is (on relation to the center of screen)
- off_type (str) – if ‘pixel’ off will be measured in pixels, if ‘percent’ (or ‘%’) off will be measured in percent of screen
- keyboard (
Keyboard
) – keyboard which will be used in menu
- places (
Returns menu which is horizontal.
Parameters: - places (
PLACE
or list ofPLACE
) – place/es on which will menu be blitted - distance (int) – distance between each option
- options (
option
) – menu options - off (tuple of two ints) – how off menu is (on relation to the center of screen)
- off_type (str) – if ‘pixel’ off will be measured in pixels, if ‘percent’ (or ‘%’) off will be measured in percent of screen
- keyboard (
Keyboard
) – keyboard which will be used in menu
- places (
-
class
Mind.Imagination.
printer
(x, y, font, newl, color=(0, 0, 0))[source]¶ Basic printer (for print()) class.
Parameters: - x (int) – x of print place
- y (int) – y of print place
- font (pygame.font.Font) – text font
- newl (int) – space between lines
-
class
Mind.Imagination.
option
(image, menu, do=<function useless>, pos_do=<function useless>, anti_pos_do=<function useless>)[source]¶ Bacis menu option class.
Parameters: - image (pygame.Surface) – option image
- menu (
Main_menu
) – option menu - do (function) – what happens when option is activated
- pos_do (function) – what happens when index comes to option
- anti_pos_do (function) – what happens when index to another option
-
class
Mind.Imagination.
pusher
(x1, y1, image, obj, do, pos_do, anti_pos_do)[source]¶ Bacis independed option class (mostly used in option class).*
-
class
Mind.Imagination.
text_option
(font, text, color, menu, do=<function useless>, pos_do=<function useless>, anti_pos_do=<function useless>, cl_txt=None)[source]¶ Textual menu option class(subclass of option).
Parameters: - font (pygame.font.Font) – option font
- color (color-like tuple) – option color
- text (str) – option text
- menu (
Main_menu
) – option menu - do (function) – what happens when option is activated
- pos_do (function) – what happens when index comes to option
- anti_pos_do (function) – what happens when index to another option
-
class
Mind.Imagination.
text_pusher
(x1, y1, font, text, cl_text, color, obj, do, pos_do, anti_pos_do)[source]¶ Textual independed option class (mostly used in text_option class, subclass of pusher).*
-
class
Mind.Imagination.
input_option
(font, text, color, menu, do=<function useless>, pos_do=<function useless>, anti_pos_do=<function useless>, cl_txt=None, pub='return', ret='return', snd=<function useless>, act_on='hit')[source]¶ Input menu option class(subclass of text_option).
Parameters: - font (pygame.font.Font) – option font
- color (color-like tuple) – option color
- text (str) – option text
- menu (
Main_menu
) – option menu - do (function) – what happens when option is activated
- pos_do (function) – what happens when index comes to option
- anti_pos_do (function) – what happens when index to another option
- pub (str) – when will text be entered
- ret (str) – when will you return to main menu
- snd (function) – what happens with text you wrote
- act_on (str) – when will you enter input option