Merge pull request #6258 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
PySimpleGUI 2023-02-24 08:58:55 -05:00 committed by GitHub
commit 4a5f2d2907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 192 additions and 53 deletions

View File

@ -6248,6 +6248,7 @@ Multiline(default_text = "",
enter_submits = False,
disabled = False,
autoscroll = False,
autoscroll_only_at_bottom = False,
border_width = None,
size = (None, None),
s = (None, None),
@ -6299,6 +6300,7 @@ Parameter Descriptions:
| bool | enter_submits | if True, the Window.read call will return is enter key is pressed in this element |
| bool | disabled | set disable state |
| bool | autoscroll | If True the contents of the element will automatically scroll as more data added to the end |
| bool | autoscroll_only_at_bottom | If True the contents of the element will automatically scroll only if the scrollbar is at the bottom of the multiline |
| int | border_width | width of border around element in pixels |
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
@ -7235,6 +7237,7 @@ Output(size = (None, None),
text_color = None,
pad = None,
p = None,
autoscroll_only_at_bottom = False,
echo_stdout_stderr = False,
font = None,
tooltip = None,
@ -7260,31 +7263,32 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| str | background_color | color of background |
| str | text_color | color of the text |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| bool | echo_stdout_stderr | If True then output to stdout will be output to this element AND also to the normal console location |
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element |
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
| bool | wrap_lines | If True, the lines will be wrapped automatically. Other parms affect this setting, but this one will override them all. Default is it does nothing and uses previous settings for wrapping. |
| bool | horizontal_scroll | Controls if a horizontal scrollbar should be shown. If True, then line wrapping will be off by default |
| str | sbar_trough_color | Scrollbar color of the trough |
| str | sbar_background_color | Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over |
| str | sbar_arrow_color | Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over |
| int | sbar_width | Scrollbar width in pixels |
| int | sbar_arrow_width | Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar |
| str | sbar_frame_color | Scrollbar Color of frame around scrollbar (available only on some ttk themes) |
| str | sbar_relief | Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID |
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| str | background_color | color of background |
| str | text_color | color of the text |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| bool | autoscroll_only_at_bottom | If True the contents of the element will automatically scroll only if the scrollbar is at the bottom of the multiline |
| bool | echo_stdout_stderr | If True then output to stdout will be output to this element AND also to the normal console location |
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element |
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
| bool | wrap_lines | If True, the lines will be wrapped automatically. Other parms affect this setting, but this one will override them all. Default is it does nothing and uses previous settings for wrapping. |
| bool | horizontal_scroll | Controls if a horizontal scrollbar should be shown. If True, then line wrapping will be off by default |
| str | sbar_trough_color | Scrollbar color of the trough |
| str | sbar_background_color | Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over |
| str | sbar_arrow_color | Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over |
| int | sbar_width | Scrollbar width in pixels |
| int | sbar_arrow_width | Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar |
| str | sbar_frame_color | Scrollbar Color of frame around scrollbar (available only on some ttk themes) |
| str | sbar_relief | Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID |
### bind

View File

@ -7112,12 +7112,54 @@ There are a number of demo programs that show how to use UserSettings to create
If you're using the default path, remember that previous runs of your file may have old settings that are still in your settings file. It can get confusing when you've forgotten that you previously wrote a setting. Not seeing the filename can have drawbacks like this.
Also, because the settings automatically save after every update, it can be easy to accidently overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
Also, because the settings automatically save after every update, it can be easy to accidentally overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
To save your Python dictionary to a settings file, simply call `user_settings_write_new_dictionary(dict)`, passing in your dictionary as the parameter.
-------------------------
# Timer API
The Timer API calls are in version 4.61.0 that is currently only available on the PySimpleGUI GitHub. It has not been released to PyPI yet.
## Do Not Use Sleeps In Your Event Loop...
Instead of sleeping, you can request that an event be generated after some period of time. If you need to "Sleep for 3 seconds" as part of some operation, instead schedule a timer for 3 seconds. Your `window.read` call will return a value of `sg.TIMER_KEY` or `sg.EVENT_TIMER` (they are aliases and thus have the same value).
## Timer API Calls
These are the API calls that you'll use to manage timers:
`window.timer_start` starts a timer
`window.timer_stop` stops a single timer
`window.timer_stop_all` stops all timers
`window.timer_get_active_timers` returns a list of active timer IDs
Example - start a 3 second timer that does not repeat:
```python
window.timer_start(3000, repeating=False) # start a 3-second timer
```
When this timer expires, you'll get an event `sg.EVENT_TIMER`. If you want to specify your own key to be returned, then use the `key` parameter:
```python
window.timer_start(3000, key='-MY TIMER KEY-', repeating=False)
```
See the call reference for the details of each call.
## Timer Demo Programs
Using the PySimpleGUI Demo Browser, search for `window.timer_` to find Demo Programs that use the Timer API calls.
The program `Demo_WindowTimer.py` demonstrates both repeating and non-repeating timers as well as using custom keys. It's a simple set of API calls to use and the docstrings in combination with the Demo Programs should give you all you need to start using this capability.
---------------------------
# Extending PySimpleGUI
PySimpleGUI doesn't and can't provide every single setting available in the underlying GUI framework. Not all tkinter options are available for a `Text` Element. Same with PySimpleGUIQt and the other ports.

View File

@ -5574,13 +5574,60 @@ There are a number of demo programs that show how to use UserSettings to create
If you're using the default path, remember that previous runs of your file may have old settings that are still in your settings file. It can get confusing when you've forgotten that you previously wrote a setting. Not seeing the filename can have drawbacks like this.
Also, because the settings automatically save after every update, it can be easy to accidently overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
Also, because the settings automatically save after every update, it can be easy to accidentally overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
To save your Python dictionary to a settings file, simply call `user_settings_write_new_dictionary(dict)`, passing in your dictionary as the parameter.
-------------------------
# Timer API
The Timer API calls are in version 4.61.0 that is currently only available on the PySimpleGUI GitHub. It has not been released to PyPI yet.
## Do Not Use Sleeps In Your Event Loop...
Instead of sleeping, you can request that an event be generated after some period of time. If you need to "Sleep for 3 seconds" as part of some operation, instead schedule a timer for 3 seconds. Your `window.read` call will return a value of `sg.TIMER_KEY` or `sg.EVENT_TIMER` (they are aliases and thus have the same value).
## Timer API Calls
These are the API calls that you'll use to manage timers:
`window.timer_start` starts a timer
`window.timer_stop` stops a single timer
`window.timer_stop_all` stops all timers
`window.timer_get_active_timers` returns a list of active timer IDs
Example - start a 3 second timer that does not repeat:
```python
window.timer_start(3000, repeating=False) # start a 3-second timer
```
When this timer expires, you'll get an event `sg.EVENT_TIMER`. If you want to specify your own key to be returned, then use the `key` parameter:
```python
window.timer_start(3000, key='-MY TIMER KEY-', repeating=False)
```
See the call reference for the details of each call.
## Timer Demo Programs
Using the PySimpleGUI Demo Browser, search for `window.timer_` to find Demo Programs that use the Timer API calls.
The program `Demo_WindowTimer.py` demonstrates both repeating and non-repeating timers as well as using custom keys. It's a simple set of API calls to use and the docstrings in combination with the Demo Programs should give you all you need to start using this capability.
---------------------------
# Extending PySimpleGUI

View File

@ -6248,6 +6248,7 @@ Multiline(default_text = "",
enter_submits = False,
disabled = False,
autoscroll = False,
autoscroll_only_at_bottom = False,
border_width = None,
size = (None, None),
s = (None, None),
@ -6299,6 +6300,7 @@ Parameter Descriptions:
| bool | enter_submits | if True, the Window.read call will return is enter key is pressed in this element |
| bool | disabled | set disable state |
| bool | autoscroll | If True the contents of the element will automatically scroll as more data added to the end |
| bool | autoscroll_only_at_bottom | If True the contents of the element will automatically scroll only if the scrollbar is at the bottom of the multiline |
| int | border_width | width of border around element in pixels |
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
@ -7235,6 +7237,7 @@ Output(size = (None, None),
text_color = None,
pad = None,
p = None,
autoscroll_only_at_bottom = False,
echo_stdout_stderr = False,
font = None,
tooltip = None,
@ -7260,31 +7263,32 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| str | background_color | color of background |
| str | text_color | color of the text |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| bool | echo_stdout_stderr | If True then output to stdout will be output to this element AND also to the normal console location |
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element |
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
| bool | wrap_lines | If True, the lines will be wrapped automatically. Other parms affect this setting, but this one will override them all. Default is it does nothing and uses previous settings for wrapping. |
| bool | horizontal_scroll | Controls if a horizontal scrollbar should be shown. If True, then line wrapping will be off by default |
| str | sbar_trough_color | Scrollbar color of the trough |
| str | sbar_background_color | Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over |
| str | sbar_arrow_color | Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over |
| int | sbar_width | Scrollbar width in pixels |
| int | sbar_arrow_width | Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar |
| str | sbar_frame_color | Scrollbar Color of frame around scrollbar (available only on some ttk themes) |
| str | sbar_relief | Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID |
| (int, int) or (None, None) or int | size | (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1 |
| (int, int) or (None, None) or int | s | Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| str | background_color | color of background |
| str | text_color | color of the text |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | pad | Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | p | Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| bool | autoscroll_only_at_bottom | If True the contents of the element will automatically scroll only if the scrollbar is at the bottom of the multiline |
| bool | echo_stdout_stderr | If True then output to stdout will be output to this element AND also to the normal console location |
| (str or (str, int[, str]) or None) | font | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str or int or tuple or object | key | Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element |
| str or int or tuple or object | k | Same as the Key. You can use either k or key. Which ever is set will be used. |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | expand_x | If True the element will automatically expand in the X direction to fill available space |
| bool | expand_y | If True the element will automatically expand in the Y direction to fill available space |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
| bool | wrap_lines | If True, the lines will be wrapped automatically. Other parms affect this setting, but this one will override them all. Default is it does nothing and uses previous settings for wrapping. |
| bool | horizontal_scroll | Controls if a horizontal scrollbar should be shown. If True, then line wrapping will be off by default |
| str | sbar_trough_color | Scrollbar color of the trough |
| str | sbar_background_color | Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over |
| str | sbar_arrow_color | Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over |
| int | sbar_width | Scrollbar width in pixels |
| int | sbar_arrow_width | Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar |
| str | sbar_frame_color | Scrollbar Color of frame around scrollbar (available only on some ttk themes) |
| str | sbar_relief | Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID |
### bind

View File

@ -7112,12 +7112,54 @@ There are a number of demo programs that show how to use UserSettings to create
If you're using the default path, remember that previous runs of your file may have old settings that are still in your settings file. It can get confusing when you've forgotten that you previously wrote a setting. Not seeing the filename can have drawbacks like this.
Also, because the settings automatically save after every update, it can be easy to accidently overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
Also, because the settings automatically save after every update, it can be easy to accidentally overwrite a previously saved setting. If you want to avoid this, then perhaps it's best that you work with a dictionary within your code and then explicitly save your dictionary when you're ready to commit it to disk.
To save your Python dictionary to a settings file, simply call `user_settings_write_new_dictionary(dict)`, passing in your dictionary as the parameter.
-------------------------
# Timer API
The Timer API calls are in version 4.61.0 that is currently only available on the PySimpleGUI GitHub. It has not been released to PyPI yet.
## Do Not Use Sleeps In Your Event Loop...
Instead of sleeping, you can request that an event be generated after some period of time. If you need to "Sleep for 3 seconds" as part of some operation, instead schedule a timer for 3 seconds. Your `window.read` call will return a value of `sg.TIMER_KEY` or `sg.EVENT_TIMER` (they are aliases and thus have the same value).
## Timer API Calls
These are the API calls that you'll use to manage timers:
`window.timer_start` starts a timer
`window.timer_stop` stops a single timer
`window.timer_stop_all` stops all timers
`window.timer_get_active_timers` returns a list of active timer IDs
Example - start a 3 second timer that does not repeat:
```python
window.timer_start(3000, repeating=False) # start a 3-second timer
```
When this timer expires, you'll get an event `sg.EVENT_TIMER`. If you want to specify your own key to be returned, then use the `key` parameter:
```python
window.timer_start(3000, key='-MY TIMER KEY-', repeating=False)
```
See the call reference for the details of each call.
## Timer Demo Programs
Using the PySimpleGUI Demo Browser, search for `window.timer_` to find Demo Programs that use the Timer API calls.
The program `Demo_WindowTimer.py` demonstrates both repeating and non-repeating timers as well as using custom keys. It's a simple set of API calls to use and the docstrings in combination with the Demo Programs should give you all you need to start using this capability.
---------------------------
# Extending PySimpleGUI
PySimpleGUI doesn't and can't provide every single setting available in the underlying GUI framework. Not all tkinter options are available for a `Text` Element. Same with PySimpleGUIQt and the other ports.