Screen definition:
Code: Select all
screen glossary():
text "Glossary" size 40 xalign 0.5 ypos 20
hbox spacing 200:
viewport:
xpos 50 ypos 100 xsize 300 ysize 500
child_size (None, 4000)
scrollbars "vertical"
spacing 5
draggable True
mousewheel True
arrowkeys True
add "#000c"
vbox spacing 20:
# use sorted(glossary_dict.keys()) instead of glossary_dict
# to arrange the terms in alphabetic order
for word in glossary_dict:
textbutton word:
action SetVariable("display_desc", word)
vbox ypos 100 xsize 650 ysize 500 box_wrap True:
text glossary_dict.get(display_desc, "")
Code: Select all
init -1 python:
display_desc = ""
glossary_dict = \
{'Absurdity': 'A statement or belief manifestly inconsistent with',
'Academe': 'An ancient school where morality and philosophy were',
...
}
Download here or view the code on github. Thanks for reading!