view gamelib/custom_widgets.py @ 693:c8b683dd56d3 pyntnclick

Better modal message and result handling.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 14 Feb 2012 15:36:28 +0200
parents 497b6d7c55e7
children efa58c92b304
line wrap: on
line source

"""Custom widgets for Suspened Sentence"""

import pygame
from pyntnclick.widgets.text import WrappedTextLabel


class JimLabel(WrappedTextLabel):
    """Custom widget for JIM's speech"""

    def __init__(self, gd, mesg):
        rect = pygame.Rect((0, 0), (1, 1))
        super(JimLabel, self).__init__(rect, gd,
                text=mesg, fontname='Monospace.ttf', fontsize=20,
                bg_color=pygame.Color(255, 175, 127, 191),
                color=pygame.Color(0, 0, 0),
                border_color=pygame.Color(127, 15, 0))
        # Centre the widget
        # Should this happen automatically in state?
        self.rect.center = (gd.constants.screen[0] / 2,
                gd.constants.screen[1] / 2)