Package pyzzle :: Module standard
[hide private]
[frames] | no frames]

Module standard

source code

A collection of commonly used, global functions

Functions [hide private]
 
beginDraw()
Runs the draw() method on pyzzle.panel.
source code
 
endDraw()
Finalizes drawing.
source code
 
drawCursor(cursor)
Displays the cursor Useful for creating custom transitions.
source code
 
draw()
Draws everything in pyzzle.panel.
source code
 
pause(delay=1)
Pauses the game.
source code
Rect
dragRect(color=(0,0,0))
Waits for user to drag the mouse.
source code
 
dragLines(cursor='fist.png', pointlist) source code
(int,int)
drag(cursor='fist.png')
Waits for user to drag the mouse.
source code
 
prompt(text, color=None, fontSize=36)
Prompts a message to the user.
source code
string
promptText(question='', answer='', numeric=False, allowExit=True, color=None, fontSize=36)
Prompts the user to input text.
source code
float
promptNumber(question='', **param)
Prompts the user to input a number.
source code
string
promptChoice(question='', choices=[], allowExit=True, color=None, fontFile=None, fontSize=None, spacing=20, selectionColor=None)
Prompts the user to answer a multiple choice question.
source code
 
_pan(self, towards, aways) source code
 
panRight(self)
Moves the slide right, and jumps back to the slide's left when it con go no further.
source code
 
panLeft(self)
Moves the slide left, and jumps back to the slide's right when it con go no further.
source code
 
beginTransition(oldslide, newslide, delay=0, panel=None)
Prepares slides for transition.
source code
 
endTransition(oldslide, newslide, delay=0, panel=None)
Finalizes slide transition.
source code
 
_noTransition(*p, **k) source code
 
transition(oldslide=None, newslide=None, delay=0, **param)
Basic transition function.
source code
 
_scroll(oldslide, newslide, towards, aways, delay=0, **param) source code
 
_scrollfn(towards, aways) source code
 
fade(oldslide=None, newslide=None, delay=0, color=(0,0,0), alpha=255, **param)
Transitions slides by fade in/out.
source code
 
cutscene(oldslide=None, newslide=None, delay=0, onStart=fade, onStop=fade, allowExit=True, moviefile=None, soundfile=None, movie=None, **param)
Transitions from oldslide, plays a movie, and transitions back to newslide.
source code
Variables [hide private]
  scrollRight = _scrollfn('right', 'left')
  scrollLeft = _scrollfn('left', 'right')
  scrollDown = _scrollfn('bottom', 'top')
  scrollUp = _scrollfn('top', 'bottom')
Function Details [hide private]

beginDraw()

source code 

Runs the draw() method on pyzzle.panel. Useful for creating custom transitions.

endDraw()

source code 

Finalizes drawing. Useful for creating custom transitions.

draw()

source code 

Draws everything in pyzzle.panel. Does not run any highlight() methods.

pause(delay=1)

source code 

Pauses the game.

Parameters:
  • delay - The number of seconds to pause the game.

dragRect(color=(0,0,0))

source code 

Waits for user to drag the mouse. Draws a rectangle that highlights the user's selection.

Parameters:
  • color ((int,int,int)) - Color of the rectangle to be drawn.
Returns: Rect
The user's selection.

drag(cursor='fist.png')

source code 

Waits for user to drag the mouse.

Parameters:
  • cursor - Name of the cursor file to display while dragging
Returns: (int,int)
coordinates of the cursor after the drag.

prompt(text, color=None, fontSize=36)

source code 

Prompts a message to the user. The user may press any key so any mousebutton to continue.

Parameters:
  • text - The message to display.
  • color - The color of message text.
  • fontSize - The size of message text.

promptText(question='', answer='', numeric=False, allowExit=True, color=None, fontSize=36)

source code 

Prompts the user to input text.

Parameters:
  • question - A question to display to the user.
  • answer - The default answer.
  • numeric - Whether only numeric characters are allowed.
  • allowExit - Whether the user may escape the prompt by hitting ESC
  • color - The color of question and answer text.
  • fontSize - The size of question and answer text.
Returns: string
The text the user has entered, or None if the user escaped the prompt.

promptNumber(question='', **param)

source code 

Prompts the user to input a number.

Parameters:
  • question - A question to display to the user.
  • **param - Arguments of the promptText function.
Returns: float
The number the user has entered, or None if the user escaped the prompt. Returns a float or None if user escapes from prompt.

See Also: promptText

promptChoice(question='', choices=[], allowExit=True, color=None, fontFile=None, fontSize=None, spacing=20, selectionColor=None)

source code 

Prompts the user to answer a multiple choice question.

Parameters:
  • question - A question to display to the user.
  • choices - The choices the user may select.
  • allowExit - Whether the user may escape the prompt by hitting ESC
  • color - The color of question and choice text.
  • fontSize - The size of question and answer text.
  • spacing - The spacing between each choice, in pixels.
  • param - The color of choice text when highlighted by the user.
Returns: string
The text the user has selected, or None if the user escaped the prompt.

panRight(self)

source code 

Moves the slide right, and jumps back to the slide's left when it con go no further. Used in panoramic slides.

panLeft(self)

source code 

Moves the slide left, and jumps back to the slide's right when it con go no further. Intended as a choice for Hotspot.onHighlight. Used in panoramic slides.

beginTransition(oldslide, newslide, delay=0, panel=None)

source code 

Prepares slides for transition.

Parameters:
  • oldslide (Panel) - The Panel to exit.
  • newslide (Panel) - The Panel to enter.
  • delay - The time it should take to perform onStart and onStop individually, in seconds.
  • panel (Panel) - The new parent panel of newslide. pyzzle.panel by default.

Attention: Must be used when creating custom transition functions.

endTransition(oldslide, newslide, delay=0, panel=None)

source code 

Finalizes slide transition.

Parameters:
  • oldslide (Panel) - The Panel to exit.
  • newslide (Panel) - The Panel to enter.
  • delay - The time it should take to perform onStart and onStop individually, in seconds.
  • panel (Panel) - The new parent panel of newslide. pyzzle.panel by default.

Attention: Must be used when creating custom transition functions.

transition(oldslide=None, newslide=None, delay=0, **param)

source code 

Basic transition function. Pauses the game for a given number of seconds, then flashes to newslide

Parameters:
  • oldslide (Panel) - The Panel to exit.
  • newslide (Panel) - The Panel to enter.
  • delay - The time it should take to perform onStart and onStop individually, in seconds.
  • **param - Additional arguments used in beginTransition() and endTransition()

fade(oldslide=None, newslide=None, delay=0, color=(0,0,0), alpha=255, **param)

source code 

Transitions slides by fade in/out. Currently works best on full screen slides.

Parameters:
  • oldslide (Panel) - The Panel to fade out of.
  • newslide (Panel) - The Panel to fade in to.
  • delay - The time it should take perform each fade in/fade out.
  • color ((int,int,int)) - The color at maximum fade
  • alpha - The alpha transparency of the slide at maximum fade
  • **param - Additional arguments used in beginTransition() and endTransition()

cutscene(oldslide=None, newslide=None, delay=0, onStart=fade, onStop=fade, allowExit=True, moviefile=None, soundfile=None, movie=None, **param)

source code 

Transitions from oldslide, plays a movie, and transitions back to newslide.

Parameters:
  • oldslide (Panel) - The Panel to exit.
  • newslide (Panel) - The Panel to enter.
  • delay - The time it should take to perform onStart and onStop individually, in seconds.
  • onStart - The transition function used to transition from oldslide to the movie
  • onStop - The transition function used to transition from the movie to newslide
  • allowExit - Whether the user can skip the movie by hitting ESC.
  • moviefile - The name of the movie file to play. Pygame currently only supports the MPEG-1 video codec.
  • soundfile - The name of the sound file to play along with the movie. Any sound from the movie will be replaced with this sound. Use this if you are having trouble getting movie sound to play in Pygame.
  • movie (Movie) - An instance of the Movie class to play. If specified, any file you specify with the moviefile parameter will be ignored.
  • **param - Additional arguments used in beginTransition() and endTransition()