sys.exit() Colors = { "Green": Color.green, "Magenta": Color.magenta, "Cyan": Color.cyan, "Blue": Color.blue, "Red": Color.red, "Yellow": Color.yellow, "Black": Color.black, "Orange": Color.orange, "Gray": Color.gray } # Saveする Directoryの文字列を作成 dir_names = [s for s in parent_dir.split("/") if not s == ''] dir_depth = len(dir_names) base_dir_name = dir_names[dir_depth - 1] new_dir = "{}_HyperStacks".format(base_dir_name) save_dir = os.path.join(parent_dir, new_dir) # Saveするためのディレクトリと Alert Dialogを作成 def canceled(): gd = GenericDialog("Caution") gd.addMessage('Tiff file(s) already exists in {}.\n \ The file may be replaced by this macro run. Do you wish to continue?'. format(save_dir)) gd.showDialog() return gd.wasCanceled()