def EzAlertDialog(message, title=None, stage=None): from javafx.scene.control import Alert from javafx.scene.control.Alert import AlertType from javafx.stage import Modality alert = Alert(AlertType.INFORMATION) if stage: alert.initOwner(stage) if title: alert.setTitle(title) alert.setHeaderText("") alert.setContentText(message) alert.initModality(Modality.APPLICATION_MODAL) alert.showAndWait()
def EzYesNoDialog(message, title, stage=None): from javafx.scene.control import Alert from javafx.scene.control.Alert import AlertType from javafx.stage import Modality from javafx.scene.control import ButtonType alert = Alert(AlertType.CONFIRMATION) if stage: alert.initOwner(stage) if title: alert.setTitle(title) alert.setHeaderText("") alert.setContentText(message) alert.initModality(Modality.APPLICATION_MODAL) result = alert.showAndWait() if result.get() == ButtonType.OK: return True else: return False