The WordleGraphics Module
Even though you don’t need to make any changes to it or understand the details of its operation, you need to know what capabilities the WordleGraphics
module has on offer so that you can use those facilities in your code. The most important thing to know is that this library module exports a data type called WordleGWindow
, which implements all the graphical capabilities of the game. The methods exported by the WordleGWindow
type are outlined below in Table 1. The right column gives a brief description of what these functions do, though more complete descriptions appear later in this guide in the description of the milestones that require them.
WordleGWindow
object. I have included the dot before each function/method name as a reminder that you will call these methods on the WordleGWindow
object using the receiver syntax we discussed in class. In the starting code, that object is named gw
and is defined on line 21.
Function | Description |
---|---|
WordleGWindow() |
Creates and displays the graphics window |
.set_square_letter(row, col, letter) |
Sets the letter in the specified row and column |
.get_square_letter(row, col) |
Returns the letter in the specified row and column |
.add_enter_listener(func) |
Specifies the function to be run when the ENTER key is pressed |
.show_message(msg) |
Shows a message below the squares |
.set_square_color(row, col, color) |
Sets the color of the specified square |
.get_square_color(row, col) |
Returns the color of the specified square |
.set_current_row(row_idx) |
Sets the row index in which typed characters appear |
.get_current_row() |
Returns the current row index |
.set_key_color(letter, color) |
Sets the color of the specified key letter |
.get_key_color(letter) |
Returns the color of the specified key letter |