Try this:
from javax.swing import JOptionPane
pane = JOptionPane()
strMessage = "<html><center>Are you sure you want to close this pop-up?<br><br>Any unsaved data will be lost!"
strTitle = "Confirm Close"
frame = None
btnOpts = JOptionPane.OK_CANCEL_OPTION
msgType = JOptionPane.WARNING_MESSAGE
icon = None
options=["OK", "Cancel"]
idxResult = pane.showOptionDialog(frame, strMessage, strTitle, btnOpts, msgType, icon, options, options[1])
If idxResult == 0:
[Close window code]
For more info on Java swing dialogs, see: http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html