User Interface

Our plan was to create a graphical user interface (GUI) where the user could select the LEGO mat size they want their image to be pixelated to and click a button to input an image from their files. Upon clicking the "Select Image" button, the user would then be taken to another window that displayed the original image and the new, pixelated image side-by-side, in addition to the total cost of the LEGO bricks and a key of colors.

We chose to use the Kivy library to accomplish this goal. We initially went about the problem by creating two separate programs, one that allowed the user to select the base plate size, and to click on a button leading to a file browser, and the other being a file browser. Our original architecture was such that when one selected the file browser button, the widgets, or small blocks of the screen with different purposes were erased and the file browser, which is a modified version of the advanced file browser included in the Kivy Garden library was written onto the blank screen where the widgets were. If you then selected the .png file that you wanted to turn into a LEGO set, the file browser would close and the screen would again be cleared of widgets. At this point the file browser portion of our code would run our back end code, and create a final screen with the LEGO version of the picture and information about that LEGO set.

Although effective, our old architecture had limitations, which we discovered when we decided to add a back button that would allow the user to change what they had input. When clicked, this button just cleared the screen and ran our entire GUI program again. We discovered that this did not work with our program--when the user clicked the back button and selected a new image, the final output was still a pixelated version of the previously selected image. Upon discussing this issue with one of our professors, we decided to instead implement the Screen Manager functionality of Kivy to better separate the App Bodies so that they can be contained within one app and switched between. We previously only had one App Body, which was the reason our code didn't do what we hope for it to do.