Milestone 0: Storing keyboard state
The first step on your way to implementing an interactive Enigma machine is to make the keyboard operational, which requires creating a data structure to record which keys have been pressed and then completing the definitions of the methods key_pressed, key_released, and is_key_down. For context, the key_pressed and key_released methods are called by the EnigmaView.py module whenever the user presses the mouse down or releases it over one of the keys on the display, passing that letter as an argument. For these operations, the EnigmaView.py module is acting as the controller. The is_key_down method is called when the EnigmaView.py module is operating as a view. As it repaints the display, it asks the model about the state of each key by calling the is_key_down method, which should return True if the key is down.
As the implementer, you have several choices in terms of how you represent the state of the keys inside the model. Remember that the model needs to keep track of what keys are currently pressed, or else it won’t be able to inform the view about what lamps to light up! Given that the methods in the EnigmaModel class take single-character strings as arguments, the most straightforward approach is to store the state of the keys in a dictionary, using the letter as the key and a boolean as the corresponding value, which is False if the key is up and True if the key is down. If you use this strategy, each of the methods you have to write are just one line of code! Alternatively, you could store the key state in a 26-element list, where the index is the position of the letter in the alphabet (A = 0, B = 1, etc.). A third strategy, which is likely to be overly complex for this milestone, is to define a new EnigmaKey class that holds the state, and then store those values in a dictionary or list.
The important point to observe here is that the relationship between the model and the view is independent of the underlying implementation. The EnigmaView class is acting as a client of EnigmaModel. When it makes a call to a method like is_key_down, the view cares about the answer it gets back but is unconcerned about how the EnigmaModel class stores that information internally.
Once you have defined the internal data structure to record whether keys are pressed and completed the implementations of key_pressed, key_released, and is_key_down, you should be able to press the mouse down on the key images and have the letter change color to red. Releasing the mouse button restores the original key color.