|
Sudoku Showcase
|
Graphical user interface representing the View layer of the application's Model-View-Controller architecture. More...
Public Member Functions | |
| def | __init__ (self, "App" app) |
| Creates an instance of UI. More... | |
| None | run (self) |
| Call when ui initialized and ready to go. More... | |
| int | cellHeight (self) |
| Properties. More... | |
| int | cellWidth (self) |
| (readonly property) defines the cell-width by the cell height More... | |
| None | cellHeight (self, int size) |
| Set the property cellHeight. More... | |
| Theme | theme (self) |
| The currently selected Theme. More... | |
| None | update (self) |
| Update functions. More... | |
| None | onMistake (self) |
| Updates the ui and update again after one second. More... | |
| None | showGameOver (self, str label="Game Over!!!") |
| shows the Game-Over-Screen. More... | |
| None | showGameWin (self, str label="Congratulation!!!") |
| Shows the Win-screen. More... | |
| None | onNewGame (self) |
| To call when a new game is started. More... | |
| None | onKeyboardInput (self) |
| Eventhandler on keyboard input TODO implement. More... | |
Public Attributes | |
| app | |
| menubar | |
| newGame | |
| modesMenu | |
| highlightDigitsVar | |
| highlightRulesVar | |
| themesMenu | |
| themeVar | |
| windowMenu | |
| windowSizeVar | |
| topFrame | |
| gridFrame | |
| bottomFrame | |
| cellHeight | |
Static Public Attributes | |
| tuple | DEFAULT_FONT = ('Britannic', 13, 'bold') |
| tuple | GAME_END_FONT = ("Courier New", 13, "bold") |
| dictionary | CELL_SIZE = {"Small": 1, "Standard": 2, "Large": 3} |
| DEFAULT_LIGHT_THEME | |
Graphical user interface representing the View layer of the application's Model-View-Controller architecture.
The UI is responsible solely for visualization and user interaction. It contains no Sudoku rules, solving logic, or gameplay validation. All state changes and logic interactions are delegated to the App controller through public interface functions.
The interface is implemented using tkinter and dynamically creates the window, game grid, menus, digit buttons, status displays, and theme-based visual styling.
The UI follows a pull-based design instead of an event distribution system. Required information is queried from the App whenever the interface updates, while user actions are forwarded back to the App.
The class provides functionality for:
Many internal helper functions are intentionally implemented as nested submethods to improve readability and structure while avoiding an unnecessarily large public interface.
| def sudoku.ui.UI.__init__ | ( | self, | |
| "App" | app | ||
| ) |
Creates an instance of UI.
This also creates the window and the main attributes.
| int sudoku.ui.UI.cellHeight | ( | self | ) |
Properties.
(property) the cell-height
| None sudoku.ui.UI.cellHeight | ( | self, | |
| int | size | ||
| ) |
Set the property cellHeight.
| int sudoku.ui.UI.cellWidth | ( | self | ) |
(readonly property) defines the cell-width by the cell height
| None sudoku.ui.UI.onKeyboardInput | ( | self | ) |
Eventhandler on keyboard input TODO implement.
| None sudoku.ui.UI.onMistake | ( | self | ) |
Updates the ui and update again after one second.
NOTE: update itself recolors the cells causing mistakes.
| None sudoku.ui.UI.onNewGame | ( | self | ) |
To call when a new game is started.
Uses the states provided by the app-object
| None sudoku.ui.UI.run | ( | self | ) |
Call when ui initialized and ready to go.
| None sudoku.ui.UI.showGameOver | ( | self, | |
| str | label = "Game Over!!!" |
||
| ) |
shows the Game-Over-Screen.
| label | str - the label to show on Game Over |
| None sudoku.ui.UI.showGameWin | ( | self, | |
| str | label = "Congratulation!!!" |
||
| ) |
Shows the Win-screen.
| label | str - the label to show on Game Win |
| Theme sudoku.ui.UI.theme | ( | self | ) |
The currently selected Theme.
| None sudoku.ui.UI.update | ( | self | ) |
Update functions.
Updates and colorizes the grid, the digit Buttons. Also updates the mistakes count.
| sudoku.ui.UI.app |
| sudoku.ui.UI.bottomFrame |
|
static |
| sudoku.ui.UI.cellHeight |
|
static |
|
static |
|
static |
| sudoku.ui.UI.gridFrame |
| sudoku.ui.UI.highlightDigitsVar |
| sudoku.ui.UI.highlightRulesVar |
| sudoku.ui.UI.menubar |
| sudoku.ui.UI.modesMenu |
| sudoku.ui.UI.newGame |
| sudoku.ui.UI.themesMenu |
| sudoku.ui.UI.themeVar |
| sudoku.ui.UI.topFrame |
| sudoku.ui.UI.windowMenu |
| sudoku.ui.UI.windowSizeVar |