polychron.views.FrameView
Module
FrameView
Bases: Frame
Base class for Views which are frames rather than windows
parent
instance-attribute
parent = parent
A reference to the parent frame
__grid_initialised
instance-attribute
__grid_initialised: bool = False
Flag indicating if place_in_container has been called
__init__
__init__(parent: Frame) -> None
Call the base class (Frame) constructor
place_in_container
place_in_container() -> None
Initial placement of the FrameView inside the containing element using grid, before immediately hiding
visible_in_container
visible_in_container() -> None
Make the frame visible within the parent container (if it has one)
not_visible_in_container
not_visible_in_container() -> None
Make this FrameView not the "current" frame within a frame view with containers, via grid_remove
messagebox_info
messagebox_info(title: str | None = None, message: str | None = None, **options: Dict[str, Any]) -> None
Show an info message box with the provided type and message, and automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The info message |
None
|
**options
|
Dict[str, Any]
|
other arguments forwarded to |
{}
|
messagebox_warning
messagebox_warning(title: str | None = None, message: str | None = None, **options: Dict[str, Any]) -> None
Show an warning message box with the provided type and message, and automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The warning message |
None
|
**options
|
Dict[str, Any]
|
other arguments forwarded to |
{}
|
messagebox_error
messagebox_error(title: str | None = None, message: str | None = None, **options: Dict[str, Any]) -> None
Show an error message box with the provided type and message, and automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The error message |
None
|
**options
|
Dict[str, Any]
|
other arguments forwarded to |
{}
|
messagebox_askquestion
messagebox_askquestion(title: str | None = None, message: str | None = None, *args: tuple[Any, ...], icon: Literal['error', 'info', 'question', 'warning'] = 'question', **options: dict[str, Any]) -> str
Ask the user a (yes/no by default) question, with automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The error message |
None
|
*args
|
tuple[Any, ...]
|
Other positional arguments forwarded to the underlying tkinter call |
()
|
icon
|
Literal['error', 'info', 'question', 'warning']
|
The icon to display in the dialog |
'question'
|
**options
|
dict[str, Any]
|
other arguments forwarded to |
{}
|
Returns:
Type | Description |
---|---|
str
|
The selected value from the question box |
messagebox_askokcancel
messagebox_askokcancel(title: str | None = None, message: str | None = None, *args: tuple[Any, ...], icon: Literal['error', 'info', 'question', 'warning'] = 'question', **options: dict[str, Any]) -> str | None
Ask the user an ok/cancel question, with automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The error message |
None
|
*args
|
tuple[Any, ...]
|
Other positional arguments forwarded to the underlying tkinter call |
()
|
icon
|
Literal['error', 'info', 'question', 'warning']
|
The icon to display in the dialog |
'question'
|
**options
|
dict[str, Any]
|
other arguments forwarded to |
{}
|
Returns:
Type | Description |
---|---|
str | None
|
True if OK was selected |
messagebox_askyesno
messagebox_askyesno(title: str | None = None, message: str | None = None, *args: tuple[Any, ...], icon: Literal['error', 'info', 'question', 'warning'] = 'question', **options: dict[str, Any]) -> bool
Ask the user a yes/no question, with automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The error message |
None
|
*args
|
tuple[Any, ...]
|
Other positional arguments forwarded to the underlying tkinter call |
()
|
icon
|
Literal['error', 'info', 'question', 'warning']
|
The icon to display in the dialog |
'question'
|
**options
|
dict[str, Any]
|
other arguments forwarded to |
{}
|
Returns:
Type | Description |
---|---|
bool
|
True if yes was selected |
messagebox_askyesnocancel
messagebox_askyesnocancel(title: str | None = None, message: str | None = None, *args: tuple[Any, ...], icon: Literal['error', 'info', 'question', 'warning'] = 'question', **options: dict[str, Any]) -> bool | None
Ask the user a yes/no/cancel question, with automatic parent setting:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str | None
|
The message box title |
None
|
message
|
str | None
|
The error message |
None
|
*args
|
tuple[Any, ...]
|
Other positional arguments forwarded to the underlying tkinter call |
()
|
icon
|
Literal['error', 'info', 'question', 'warning']
|
The icon to display in the dialog |
'question'
|
**options
|
dict[str, Any]
|
other arguments forwarded to |
{}
|
Returns:
Type | Description |
---|---|
bool | None
|
True if yes, False if No, None if cancelled |
askopenfile
askopenfile(mode: str = 'r', *args: tuple[Any, ...], **options: dict[str, Any]) -> IO | None
Opens a tkinter file dialogue with the specified mode, forwarding arguments and keyword arugments to the underlying tkinter.filedialog.askopenfile call.
This abstracts tkinter out of Presenters, simplifying unit testing of non-GUI code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
The mode of the file to open |
'r'
|
*args
|
tuple[Any, ...]
|
other positional args, forwarded to askopenfile |
()
|
**options
|
dict[str, Any]
|
keyword arguments which are forwarded to askopenfile. parent will be overridden to be relative to the FrameView |
{}
|
Returns:
Type | Description |
---|---|
IO | None
|
The opened file (or None) |