MIABY Project - A Desktop Python Application using Kivy Framework
Tags: python, kivy, programming, motivation
Published: 2022-12-07 20:12:40

MIABY Project - A Python Application using Kivy Framework

In my journey of learning how to create solutions for people, I have always believed the best path to learn is work in real projects. This project was a collaboration in the software side to build a device which is able to show different didactics for children about basic knowledge about English and Spanish language using videos, images and text.

The device is a Bear made of wood, it has a self-made keyboard, a card reader([MFRC522](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiZ5bfg0dj7AhUYSTABHeikCSwQFnoECAwQAQ&url=https%3A%2F%2Frandomnerdtutorials.com%2Fsecurity-access-using-mfrc522-rfid-reader-with-arduino%2F&usg=AOvVaw3tv3Qn0OtQ4KmuQ60RN3Dw)), a screen monitor, and a [Raspberry Pi](https://www.raspberrypi.org/) as a platform where all the software is executed.

![Device assembling](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qsmleviohhqgbjmuyysp.jpg)

![Wooden front part](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8gixk0lqujdmwbhsbwrq.jpg)

In the program, there are 3 main didactics-features:

- **Observe:** Show a random video about tales.
- **Learn:** Show musical videos about basic concept of the language.
- **Interact:** Allow to read a card which is linked with a word, then the child can press the keys and introduce the letters corresponding to complete the word selected.

![MIABY App Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mnkm3dtg8tpolbje402f.gif)

My directory structure is arranged as follows:

- **resources:** Media used for screens like images, videos, audios and data(Media files uploaded to the repository are only examples to test).
- **scripts:** Little piece of code to use card reader MFRC522.
- **src:** Contains code about every screen.
- **main.py:** It’s the main part of the program, it contains how have to behave each screen.
- **miaby.ini:** Configuration file of Kivy App.
- **Pipfile**: To develop, I create a virtual environment using [Pipenv](https://pipenv.pypa.io/en/latest/) which create a Pipfile where all requirements are defined.

But How it works? Well, first, all behaviors of screens reside on the main.py file where I can have access to all screens and their methods and variables. To explain these behaviors, I’ll describe each screen with its function.

- **Welcome:** Show an image before enter to Home screen. At this point, the input keyboard is defined, it can be from our computer or Rasperry Pi’s GPIOs, so you can interact with the program with these key(up, down, enter, left, right).
- **Home:** Here you can choose a language between Spanish and English. When you choose one, this will update all screens to the proper image(Backgrounds and buttons). Also, the words will load in a variable for use in the Interact game mode base on language selected.
- **Game Mode:** In this screen, it shows three options mentioned before Observe, Learn and Interact. When select Observe or Learn options redirect to show video screen, and for Learn it will be Read Card.
- **Show Video:** It shows the proper video, base on language and game mode options. When the video ends, it comes back to Game Mode screen.
- **Read Card:** When this screen is called and the program is running over a Raspberry Pi, and begin to read a card. Otherwise, if we are running the program in our computer automatically will select the word “SQUARE” and next will show Text Input screen.
- **Text Input:** Here, we can use the keyboard to introduce the correct letters to complete the selected word. We can pass to the next screen only if we complete the word.
- **Message:** It shows a message when complete the word succesfully.
- **Screensaver:** When the user doesn't interact around 2 minutes, this screen will be shown and when you press enter it come back to Home screen.
- Also, in every interaction in order to change the screen, a sound effect will be played.

Here is my code, if you are interested you can test it.

[MIABY_Project - GitHub](https://github.com/Nogyboy/MIABY_Project)

This project put me in an entertaining challenge to apply all my knowledge to create a solution based on user requirements because I needed to understand how to work with software and hardware. In the end, I was able to put all together and made it work. I hope this is interesting for someone. I really enjoyed creating this project, I know I have a lot to learn and improve, but I'll keep going.

**Note:** Sorry by my English, I'm learning.