Creating the voting GUI application
There are some aspects to the voting application, such as adding proposals, giving the right to vote, and voting action itself. But you’re going to focus on the voting process itself. You’re going to build the GUI application to vote for a proposal as a voter. To vote means to choose a proposal. So, you need a widget to choose a proposal. The best widget to do that is a combo box.
So, let’s create a script that has a combo box and a button. In addition to that, let’s add a label to the GUI application so your application has a title. This time, you want the script put inside the scripts
folder inside your Ape project so that later you can integrate it with smart contract libraries. Name the script voting_gui_app.py
and add the following code to it:
from ape import accounts, project import os, sys from PySide6 import QtWidgets class VotingWidget(QtWidgets.QWidget): def __init__(self): ...