Jython-Swingutils provides a friendlier interface for displaying some common dialogs.
The swingutils.dialogs.basic module offers a slightly more convenient api for showing some basic dialogs:
from swingutils.dialogs.basic import showErrorDialog, showWarningDialog, showMessageDialog
showErrorDialog('Something terrible has happened!')
showWarningDialog('This could be bad...!')
showMessageDialog('Hello there', 'Random message')
If your application’s language is not English, and you wish to override the default titles, you can do this:
from functools import partial
showErrorDialog = partial(showErrorDialog, title='Fehler')
The file chooser dialogs provide you with the following enhancements over the standard Java ones:
Examples:
from swingutils.preferences import getUserPrefs
from swingutils.dialogs.filechooser import showOpenDialog, showSaveDialog, SimpleFileFilter
prefs = getUserPrefs('/some/example/app')
txtFilter = SimpleFileFilter('.txt', None, 'Text files')
files = showOpenDialog(txtFilter, prefs=prefs, prefkey='loadedFiles', multiselect=True)
file = showSaveDialog(txtFilter, prefs=prefs, prefkey='savedFiles')