Ejemplo n.º 1
0
	def __init__(self, config_file_handler, master=None):
		"""Builds and initializes the GUI as a Interface type if instance.
		
		First, the Interface instance attributes are created, additionally
		the following instance attributes are created:
		solve_action_set -- Set of methods for the solve menu actions
		settings_action_set -- Set of methods for the settings menu actions
		play_action_set -- Set of methods for the play menu actions
		gui_builder -- Set of methods for building the PAC Sudoku GUI
		config_file -- XMLFileHandler object with the config file loaded
		interactive -- Sudokuinteractive initialized as None
		violation -- Violation flag set to False
		currently_editing -- Canvas image ID of a square initialized as None
		timer -- Sudoku timer
		_timer_increment -- Used to increment by 1 second the timer
		
		"""
		Interface.__init__(self, config_file_handler)
		self.solve_action_set = SudokuGUISolveActionSet(self)
		self.settings_action_set = SudokuGUISettingsActionSet(self)
		self.play_action_set = SudokuGUIPlayActionSet(self)
		self.gui_builder = SudokuGUIBuilder(self)
		self.config_file = config_file_handler
		self.interactive = None
		self.violation = False
		self.currently_editing = None
		self.timer = datetime(1900, 1, 1)
		self._timer_increment = timedelta(seconds=1)
		Frame.__init__(self, master)
		self.pack()
		self._create_widgets()
Ejemplo n.º 2
0
	def __init__(self, config_file_handler):
		Interface.__init__(self, config_file_handler)
		self.config_file_handler = config_file_handler
		self.time = 0
		self.recovered_time = 0
		self.loaded_game = False
		self.blank_matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0],
					[0, 0, 0, 0, 0, 0, 0, 0, 0]]