pyglet.window.dialog
Classes
- class FileOpenDialog
Bases:
EventDispatcherOpens a system file dialog window for opening files.
Added in version 3.0.
Methods
Events
- __init__(
- title: str = 'Open File',
- initial_dir: str | Path | None = None,
- initial_file: str | None = None,
- filetypes: list[tuple[str, str]] | None = None,
- multiple: bool = False,
Establish how the open file dialog will behave.
- Parameters:
title (
str) – The Dialog Window name. Defaults to “Open File”.initial_dir (
str|Path|None) – The directory to start in. If a path is not given, it is up the OS to determine behavior. On Windows, if None is passed, it will open to the last used directory.initial_file (
str|None) – The filename to prepopulate with when opening. Not supported on Mac OS.filetypes (
list[tuple[str,str]] |None) – An optional list of tuples containing (name, extension) to filter by. If none are given, all files will be shown and selectable. For example: [(“PNG”, “.png”), (“24-bit Bitmap”, “.bmp”)] For multiple file types in the same selection, separate by a semicolon. For example: [(“Images”, “.png;.bmp”)]`multiple (
bool) – bool True if multiple files can be selected. Defaults to False.
- classmethod __new__(*args, **kwargs)
- class FileSaveDialog
Bases:
EventDispatcherOpens a system file dialog window for saving files.
Added in version 3.0.
Methods
Events
- __init__(
- title: str = 'Save As',
- initial_dir: str | Path | None = None,
- initial_file: str | None = None,
- filetypes: list[tuple[str, str]] | None = None,
- default_ext: str = '',
Establish how the save file dialog will behave.
- Parameters:
title (
str) – The Dialog Window name. Defaults to “Save As”.initial_dir (
str|Path|None) – The directory to start in. If a path is not given, it is up the OS to determine behavior. On Windows, if None is passed, it will open to the last used directory.initial_file (
str|None) – A default file name to be filled in. Defaults to None.filetypes (
list[tuple[str,str]] |None) – An optional list of tuples containing (name, extension) to filter to. If the default_ext argument is not given, this list also dictates the extension that will be added to the entered file name. If a list of filetypes are not give, you can enter any file name to save as. For example: [(“PNG”, “.png”), (“24-bit Bitmap”, “.bmp”)]default_ext (
str) – A default file extension to add to the file. This will override the filetypes list if given, but will not override a manually entered extension.
- classmethod __new__(*args, **kwargs)