pyzzle :: Panel :: Panel :: Class Panel
[hide private]
[frames] | no frames]

Class Panel

source code

          object --+    
                   |    
pygame.sprite.Sprite --+
                       |
                      Panel

A pygame Sprite that borrows some methods of the pygame Group class. This allows Panels to be nested.

All nested sprites must have the rect attribute.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__iter__(self) source code
 
__contains__(self, sprite) source code
 
_getRect(self) source code
 
_setRect(self, rect) source code
 
add(self, sprite)
Adds the sprite to the Panel.
source code
 
remove(self, sprite)
Removes the sprite from the Panel.
source code
 
empty(self)
Empties all nested sprites from the Panel.
source code
 
draw(self, screen)
Draws nested sprites to the screen.
source code
string
highlight(self)
Called when the cursor hovers over the Panel.
source code
 
click(self, **param)
Called when the user clicks the Panel.
source code
 
enter(self, oldslide=None, delay=.1)
Called when the Panel is presented to the user.
source code
 
exit(self, newslide=None, delay=.1)
Called when the Panel is removed from the user.
source code

Inherited from pygame.sprite.Sprite: __repr__, add_internal, alive, groups, kill, remove_internal, update

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  cursorDefault = 'default.png'
  rect = property(_getRect, _setRect)
Instance Variables [hide private]
  enabled
Whether draw(), highlight(), and click() functions of the slide should be called by the parent panel.
  onEnter
The function that is called when the player enters the slide.
  onExit
The function that is called when the player exits the slide.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

add(self, sprite)

source code 

Adds the sprite to the Panel.

Overrides: pygame.sprite.Sprite.add

See Also: Group.add()

Note: While this method overrides Sprite.add(), it does not perform the same behavior!

remove(self, sprite)

source code 

Removes the sprite from the Panel.

Overrides: pygame.sprite.Sprite.remove

See Also: Group.add()

empty(self)

source code 

Empties all nested sprites from the Panel.

See Also: Group.empty()

draw(self, screen)

source code 

Draws nested sprites to the screen. An image attribute or draw(screen) function is needed for nested sprites to render.

Parameters:
  • screen (Surface) - The surface to draw on.

See Also: Group.draw()

highlight(self)

source code 

Called when the cursor hovers over the Panel. Calls the highlight() method of all nested sprites, where present.

Returns: string
The name of the cursor file that must be displayed

click(self, **param)

source code 

Called when the user clicks the Panel. Calls the click() method of the topmost nested sprite under the cursor. If no click() method is found, nothing happens.

enter(self, oldslide=None, delay=.1)

source code 

Called when the Panel is presented to the user. Calls the enter() method of all nested sprites, where present.

Parameters:
  • oldslide (Panel) - The Panel that was previously presented to the user, to be replaced by self
  • delay - The time it should take for oldslide to transition to self

exit(self, newslide=None, delay=.1)

source code 

Called when the Panel is removed from the user. Calls the exit() method of all nested sprites, where present.

Parameters:
  • newslide (Panel) - The Panel that self will be replaced with.
  • delay - The time it should take for self to transition to newslide.