initpython:#keysarethechoicenames#valuesarea3-tupleofimage,xpos,andyposchoice_map={"To be":("images/to_be.png",500,100),"Not to be":("images/not_to_be.png",600,200)}#gettherighttooltipvaluesfromthechoicenamedefGetChoiceTooltip(choice=None):ifchoiceinchoice_map:returnchoice_map[choice]else:returnNoneinit:#Slidetransformforthetooltiptransformtrn_choicetooltip:onshow:xalign0.3alpha0.0easein0.5xalign0.5alpha1.0onhide:xalign0.5easeout0.5xalign0.7alpha0.0#Separatescreenforthetooltipscreenchoice_tooltip(img,x,y):addimgxposxyposyattrn_choicetooltip#Themainchoicescreenscreenchoice(items):defaultchoiceTooltip=Nonewindow:style"menu_window"xalign0.5yalign0.5vbox:style"menu"spacing2forcaption,action,choseninitems:$choiceTooltip=GetChoiceTooltip(caption)ifaction:button:actionactionstyle"menu_choice_button"textcaptionstyle"menu_choice"ifchoiceTooltipisnotNone:hoveredShowTransient("choice_tooltip",dissolve,choiceTooltip[0],choiceTooltip[1],choiceTooltip[2])unhoveredHide("choice_tooltip",dissolve)else:textcaptionstyle"menu_caption"
label start: "To be or not to be?" menu: "To be": # will show an image "You chose 'to be'." "Not to be": # will show an image "You chose 'not to be'." "That is the question": # will not show an image "But I wanted the answer..."
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.