make_dialog() { local title="$1" local text_label="$2" local buttons="$3" local image="$4" tkdialog=$(cat << EOF from libtovid.appdialogs import ConfirmDialog from Tkinter import Tk buttons = '$buttons'.split(',') root = Tk() a = ConfirmDialog(root, '$title', '$text_label', buttons, '$image') a.run() EOF) echo "$tkdialog" python <<< "$tkdialog" } if make_dialog "Preview" "Preview OK ?" "yes,no" "$HOME/preview.gif"; then echo 'yes' else echo 'no' fi