本文整理匯總了Python中ij.gui.GenericDialog.enableYesNoCancel方法的典型用法代碼示例。如果您正苦於以下問題:Python GenericDialog.enableYesNoCancel方法的具體用法?Python GenericDialog.enableYesNoCancel怎麽用?Python GenericDialog.enableYesNoCancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ij.gui.GenericDialog
的用法示例。
在下文中一共展示了GenericDialog.enableYesNoCancel方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _dialog
# 需要導入模塊: from ij.gui import GenericDialog [as 別名]
# 或者: from ij.gui.GenericDialog import enableYesNoCancel [as 別名]
def _dialog(self,comment):
gd = GenericDialog(comment)
gd.enableYesNoCancel()
gd.showDialog()
if gd.wasCanceled():
print "user cancelled dialog"
sys.exit(1)
option = gd.wasOKed()
return option
示例2: get_config_file
# 需要導入模塊: from ij.gui import GenericDialog [as 別名]
# 或者: from ij.gui.GenericDialog import enableYesNoCancel [as 別名]
def get_config_file(folder):
'''Returns the config file name.'''
# Get list of files in the selected directory.
files = os.listdir(folder)
# Check if a config file is present in folder.
if default_config in files:
dialog = GenericDialog('Default config file found!')
dialog.addMessage('Use this file for the analysis?\n \n%s' % os.path.join(folder, default_config))
dialog.enableYesNoCancel()
dialog.showDialog()
if dialog.wasCanceled():
return None
elif dialog.wasOKed():
return default_config
else:
open_dialog = OpenDialog('Select a config file', folder, default_config)
return open_dialog.getFileName()
else:
# Ask user to select a config file.
open_dialog = OpenDialog('Select a config file', folder, default_config)
return open_dialog.getFileName()