Beispiel #1
0
    def __init__(self, game, parent):
        '''Constructor of UndoButton. Receive the game and the
        parent widget (frame, in this case).'''

        Observer.__init__(self)
        self._game = game
        self._game.add_observer(self, 'UNDO_STACK')
        self._button = Button(parent, text='Deshacer', command=self.undo)
        self._button.grid(row=1, column=1)
Beispiel #2
0
 def __init__(self, game, parent):
     '''Constructor of UndoButton. Receive the game and the
     parent widget (frame, in this case).'''
     
     Observer.__init__(self)
     self._game = game
     self._game.add_observer(self, 'UNDO_STACK')
     self._button = Button(parent, text='Deshacer', command=self.undo)
     self._button.grid(row=1, column=1)
Beispiel #3
0
    def __init__(self, game, parent):
        '''Initialize the canvas, the observers and the mouse bindings.'''

        Observer.__init__(self)
        self._game = game
        self._game.add_observer(self, 'CELL_OFF')
        self._game.add_observer(self, 'CELL_ON')

        self._canvas = Canvas(parent, bg=BOARD_BG_COLOR, width=280, height=280)
        self._canvas.grid(row=0, columnspan=3)
        self._canvas.bind("<Button-1>", self.left_button_pressed)

        self._selection = None
Beispiel #4
0
 def __init__(self, game, parent):
     '''Initialize the canvas, the observers and the mouse bindings.'''
     
     Observer.__init__(self)
     self._game = game
     self._game.add_observer(self, 'CELL_OFF')
     self._game.add_observer(self, 'CELL_ON')
     
     self._canvas = Canvas(parent, bg=BOARD_BG_COLOR, width=280, height=280)
     self._canvas.grid(row=0, columnspan=3)
     self._canvas.bind("<Button-1>", self.left_button_pressed)
     
     self._selection = None
Beispiel #5
0
    def __init__(self, game):
        '''Constructor of UISenku. Build the main window and the
        main frame.'''

        Observer.__init__(self)
        self._game = game  # game parameters
        self._game.add_observer(self, 'GAME_OVER')

        self._root = Tk()  # root window parameters
        self._root.title('PySenku')
        self._root.protocol("WM_DELETE_WINDOW", self.quit)

        main_frame = Frame(self._root, width=280, height=330, bd=1)
        main_frame.pack()
        BoardArea(self._game, main_frame)
        start_button = Button(main_frame)
        start_button.config(text='Nuevo', command=self.start)
        start_button.grid(row=1, column=0)
        help_button = Button(main_frame)
        help_button.config(text='Mas info...', command=self.open_help)
        help_button.grid(row=1, column=2)
        UndoButton(self._game, main_frame)
Beispiel #6
0
 def __init__(self, game):
     '''Constructor of UISenku. Build the main window and the
     main frame.'''
     
     Observer.__init__(self)
     self._game = game           # game parameters
     self._game.add_observer(self, 'GAME_OVER')
     
     self._root = Tk()           # root window parameters
     self._root.title('PySenku')
     self._root.protocol("WM_DELETE_WINDOW", self.quit)
     
     main_frame = Frame(self._root, width=280, height=330, bd=1)
     main_frame.pack()
     BoardArea(self._game, main_frame)
     start_button = Button(main_frame)
     start_button.config(text='Nuevo', command=self.start)
     start_button.grid(row=1, column=0)
     help_button = Button(main_frame)
     help_button.config(text='Mas info...', command=self.open_help)
     help_button.grid(row=1, column=2)
     UndoButton(self._game, main_frame)