Creating a GUI with Dropdown Menus
Part 2 of creating a GUI to convert units.
We'll cover the following...
Now you have a converter handy for converting MPa to psi. What if you want to convert between other units of pressure? Instead of hard-coding MPa and psi, you want to be able to give the user an OptionMenu
of all of the available pressures from the Pint
library. You will create a list
of all available pressure units, then make two OptionMenus
to let the user pick which pressures to convert between. The GUI will now look like this:
Column 1 | Column 2 | Column 3 | |
---|---|---|---|
Row 1 | Label saying “Converter” |
||
Row 2 | Label saying “Convert” |
Entry field for inputting a str |
OptionMenu with all pressures |
Row 3 |