One option is to use Carsten Blüm's Pashua with AppleScript.



Sample script:
--Note: This script is modified from the original example by the user.
(*
This example loads script "Pashua.scpt" (to be compiled from "Pashua.applescript") from the
same folder which contains this file. Pashua.scpt handles the communcation with Pashua.app.
You can either take the handlers out of Pashua.scpt and use them inline whenever you write
a script which uses Pashua, use Pashua.scpt as an AppleScript Library (OS X 10.9 or newer)
or use the "load script" approach used in this file.
*)
-- Get the path to the folder containing this script
tell application "Finder"
set thisFolder to (container of (path to me)) as string
if "Pashua:Pashua.app:" exists then
-- Looks like the Pashua disk image is mounted. Run from there.
set customLocation to "Pashua:"
else
-- Search for Pashua in the standard locations
set customLocation to ""
end if
end tell
try
set thePath to alias (thisFolder & "Pashua.scpt")
set pashuaBinding to load script thePath
tell pashuaBinding
-- Display the dialog
try
set pashuaLocation to getPashuaPath(customLocation)
set dialogConfiguration to my getDialogConfiguration(pashuaLocation)
set theResult to showDialog(dialogConfiguration, customLocation)
-- Display the result. The record keys ("... of theResult") are defined in the
-- dialog configuration string.
if {} = theResult then
display alert "Empty return value" message "It looks like Pashua had some problems using the window configuration." as warning
else if cb of theResult is not "1" and "Adrian Peterson" = tf of theResult then
display alert "Right On!" message "Adrian Peterson is the correct answer."
else if cb of theResult is not "1" and "" ≠ tf of theResult then
display alert "Oops!" message tf of theResult & " is not the correct answer." & return & return & "The correct answer is Adrian Peterson"
else if cb of theResult is not "1" and "" = tf of theResult then
display dialog "The dialog was closed without submitting the values"
else
-- The cancelbutton (named "cb" in the config string) was pressed
display dialog "The dialog was cancelled"
end if
on error errorMessage
display alert "An error occurred" message errorMessage as warning
end try
end tell
on error errStr number errorNumber
display dialog errStr
end try
-- Returns the configuration string for an example dialog
on getDialogConfiguration(pashuaLocation)
if pashuaLocation is not "" then
set img to "img.type = image
img.x = 0
img.y = 100
img.maxwidth = 600
img.tooltip = This is an element of type “image”
img.path = " & ("/Users/pd/Desktop/peterson.JPG") & return
--substitute the file path to an image where it is stored on your computer
else
set img to ""
end if
return "
# Set window title
*.title = Quiz
# Add a text field
tf.type = textfield
tf.label = Name this football player:
tf.width = 300
# Add a cancel button with default label
cb.type = cancelbutton
" & img
end getDialogConfiguration
Pashua Documentation
Sample scripts are included in the Pashua download. Install Pashua into your Applications folder. It's important to note that your compiled Applescript (.scpt) and the compiled Pashua.scpt are required to reside in the same folder if using the load script approach used in the script above.
Tested with OS X Yosemite 10.10.5, Script Editor 2.7, AppleScript 2.4, Pashua 0.10.3