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.useless(*useless_args)[source]
Function that doesn’t do anything.
-
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
|
-
Mind.Imagination.link(place)[source]
Returns function which leads game to onother place.
Parameters: | place (PLACE) – place for game current place |
Returns: | function |
-
Mind.Imagination.Quit(obj, self)[source]
Quits game.
-
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.equal(image1, image2)[source]
Test if two images are equal.*
-
class Mind.Imagination.PLACE(active=False)[source]
Bacis class for states of main menu.
Parameters: | active (bool) – place activity |
-
activate()[source]
Activates place.
-
deactivate()[source]
Deactivates place.
-
class Mind.Imagination.Game(main_place)[source]
Bacis game class main menu.
Parameters: | main_place – first place for game |
Adds menu to game.*
-
blit()[source]
Blits game current menu.
-
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 and option) |
-
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
|
-
run()[source]
Returns is game still running.
Returns: | True if game is running otherwise False |
-
kill()[source]
Ends game running.
-
class Mind.Imagination.Hyper_game[source]
Game for easy places controlling.
Adds menu to game.*
-
blit()[source]
Blits game current menu.
Sets game current menu.
Parameters: | menu (Main_menu) – Menu which will be blitted |
-
class Mind.Imagination.Keyboard(definer)[source]
Bacis keyboard class.
Parameters: | definer (list of tuples) – defines keyboard keys |
-
extend(extension)[source]
Extends keyboard definer.
Parameters: | extension (list of tuples) – defines new keyboard keys |
-
update()[source]
Updates keyboard.*
-
class Mind.Imagination.Main_menu(places, x_distance, y_distance, *options, off=(0, 0), off_type='pixel', keyboard=<Mind.Imagination.Keyboard object at 0x01ADDFD0>)[source]
Basic menu class.
Parameters: |
- places (PLACE or list of PLACE) – 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
|
-
add_option(option, seted_option=False)[source]
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
|
-
set_options()[source]
Should be executed on the end of options adding.
-
define(type=None, **options)[source]
Defines options parameters.
Parameters: |
- type (type) – type of option
- options – arguments for options
|
-
get_from(prior=False, **rest)[source]
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
|
-
set_from(seted_option=False, prior=False, **rest)[source]
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()
|
-
set_game(game)[source]
Sets menu to given game.
Parameters: | game (Game) – game which will be added to menu |
-
blit()[source]
Blits menu.
-
get_keyboard()[source]
Returns game menu keyboard.
Returns: | menu keyboard |
Return type: | Keyboard |
-
reset(*rest)[source]
Turns on all options in Main Menu.
Parameters: | rest – unimportant parameter. |
Returns menu which is vertical.
Parameters: |
- places (PLACE or list of PLACE) – 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
|
Returns menu which is horizontal.
Parameters: |
- places (PLACE or list of PLACE) – 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
|
-
class Mind.Imagination.option(image, menu, do=<function useless at 0x024ABDB0>, pos_do=<function useless at 0x024ABDB0>, anti_pos_do=<function useless at 0x024ABDB0>)[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
|
-
set_position(x, y)[source]
Sets option’s position.*
-
blit()[source]
Blits option.*
-
hit()[source]
Executed when menu index is on option and when space ispressed.*
-
bold()[source]
Executed when menu index comes on option.*
-
un_bold()[source]
Executed when menu index comes out of option.*
-
class Mind.Imagination.pusher(x1, y1, image, obj, do=None, pos_do=None, anti_pos_do=None)[source]
Bacis independed option class (mostly used in option class).*
-
blit()[source]
Blits pusher.*
-
hit()[source]
Executed when menu index is on option and when space is pressed.*
-
bold()[source]
Executed when menu index comes on option.*
-
un_bold()[source]
Executed when menu index comes out of option.*
-
reset(im, pos)[source]
Resets pusher.
-
class Mind.Imagination.text_option(font, text, color, menu, do=<function useless at 0x024ABDB0>, pos_do=<function useless at 0x024ABDB0>, anti_pos_do=<function useless at 0x024ABDB0>)[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
|
-
set_position(x, y)[source]
Sets option’s position.*
-
blit()[source]
Blits option.*
-
class Mind.Imagination.text_pusher(x1, y1, font, text, color, obj, do, pos_do, anti_pos_do)[source]
Textual independed option class (mostly used in text_option class,
subclass of pusher).*
-
update()[source]
Updates pusher.*