view gamelib/gamegui.py @ 55:86d83dcb7d42

Make text drawing easier to poke at for subclasses
author Neil Muller <drnlmuller@gmail.com>
date Mon, 07 May 2012 22:53:18 +0200
parents 655a6912e0ae
children 78dfd429b9a6
line wrap: on
line source

# -*- coding: utf-8 -*-
# vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4

"""Gui for the actual game"""

from gamelib.gui_base import Window
from gamelib.gui import BigButton
from gamelib.engine import PopWindow
from gamelib.constants import WIDTH


class ExitGameButton(BigButton):

    def __init__(self):
        super(ExitGameButton, self).__init__(((WIDTH - 128), 10), 'Exit')

    def on_click(self):
        PopWindow.post()


class GameWindow(Window):
    """Main window for the game"""

    def __init__(self, screen):
        super(GameWindow, self).__init__(screen)
        exit = ExitGameButton()
        self.add_child(exit)