DEV Community

Ybrahin Martinez
Ybrahin Martinez

Posted on • Updated on

Post #5: Everything almost done

Hi everyone! This is my 5th blog post, and it is the last before the coding phase ends. I can't believe that almost 2 months have passed, the whole experience has been awesome, however, I am going deeper into it in the next post.

Last week I was working on modifying the graphical user interface. This change was necessary to improve the lesson's context, with this information the future students of the course can know more about the interfaces and the basic differences between them. In addition, I changed the initial position of dialogs to the left upper corner, this change helps to a better experience when creating the dialogs. I made a PR with this change and it is awaiting the mentors' review. Below there is a result of this change.

Code


from browser import document, html
from browser.widgets.dialog import Dialog

# Creación de un dialogo con el título
d = Dialog("Show de preguntas Zombis", top=20, left=20)

# Agrega elementos como botones y títulos
d.panel <= html.H3(
    "Aprieta los botones",
    id="titulo_ventana",
    style=dict(textAlign="center")
)
d.panel <= html.BUTTON("Correcto", id="btn_correcto")

d.panel <= html.BUTTON("Incorrecto",
    id="btn_incorrecto",
    style=dict(marginLeft="5em")
)

Enter fullscreen mode Exit fullscreen mode

Result
Result Dialog

I made a few Proof of Concepts with different approaches until I found the best solution for my problem, however, one of the approaches that I used was inherited from the Brython class dialog and overwrote the methods that I needed. This approach was the optimal solution but I had a problem, the Brython interpreter did not allow me to do it and I had several issues with this, then I changed it to a simple solution, which can not be optimal, but remember...

Better done than perfect

Discussion (0)