commit
11ed2d91f5
|
@ -4830,7 +4830,21 @@ hide_row()
|
|||
|
||||
### print
|
||||
|
||||
Print like Python normally prints except route the output to a multline element and also add colors if desired
|
||||
Print like Python normally prints except route the output to a multiline element and also add colors if desired
|
||||
|
||||
colors -(str, str) or str. A combined text/background color definition in a single parameter
|
||||
|
||||
There are also "aliases" for text_color, background_color and colors (t, b, c)
|
||||
t - An alias for color of the text (makes for shorter calls)
|
||||
b - An alias for the background_color parameter
|
||||
c - Tuple[str, str] - "shorthand" way of specifying color. (foreground, backgrouned)
|
||||
c - str - can also be a string of the format "foreground on background" ("white on red")
|
||||
|
||||
With the aliases it's possible to write the same print but in more compact ways:
|
||||
cprint('This will print white text on red background', c=('white', 'red'))
|
||||
cprint('This will print white text on red background', c='white on red')
|
||||
cprint('This will print white text on red background', text_color='white', background_color='red')
|
||||
cprint('This will print white text on red background', t='white', b='red')
|
||||
|
||||
```
|
||||
print(args=*<1 or N object>,
|
||||
|
@ -4838,19 +4852,27 @@ print(args=*<1 or N object>,
|
|||
sep = None,
|
||||
text_color = None,
|
||||
background_color = None,
|
||||
justification = None)
|
||||
justification = None,
|
||||
colors = None,
|
||||
t = None,
|
||||
b = None,
|
||||
c = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| Any | args | The arguments to print |
|
||||
| str | end | The end char to use just like print uses |
|
||||
| str | sep | The separation character like print uses |
|
||||
| str | text_color | The color of the text |
|
||||
| str | background_color | The background color of the line |
|
||||
| str | justification | text justification. left, right, center. Can use single characters l, r, c. Sets only for this value, not entire element |
|
||||
| Any | args | The arguments to print |
|
||||
| str | end | The end char to use just like print uses |
|
||||
| str | sep | The separation character like print uses |
|
||||
| str | text_color | The color of the text |
|
||||
| str | background_color | The background color of the line |
|
||||
| str | justification | text justification. left, right, center. Can use single characters l, r, c. Sets only for this value, not entire element |
|
||||
| str) or Tuple[str, str] | colors | Either a tuple or a string that has both the text and background colors |
|
||||
| str | t | Color of the text |
|
||||
| str | b | The background color of the line |
|
||||
| str) or Tuple[str, str] | c | Either a tuple or a string that has both the text and background colors |
|
||||
|
||||
### reroute_stderr_to_here
|
||||
|
||||
|
@ -9579,6 +9601,7 @@ Parameter Descriptions:
|
|||
|--|--|--|
|
||||
| Any | key | Setting to be saved. Can be any valid dictionary key type |
|
||||
| Any | value | Value to save as the setting's value. Can be anything |
|
||||
| (Any) | **RETURN** | value that key was set to
|
||||
|
||||
### set_default_value
|
||||
|
||||
|
@ -11200,6 +11223,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11313,6 +11337,7 @@ Parameter Descriptions:
|
|||
| in-RAM image to be displayed on button | image_data | in-RAM image to be displayed on button |
|
||||
| (Default = (None)) | image_size | image size (O.K.) |
|
||||
| amount to reduce the size of the image | image_subsample | amount to reduce the size of the image |
|
||||
| int | border_width | width of border around element |
|
||||
| str | tooltip | text, that will appear when mouse hovers over the element |
|
||||
| (int, int) | size | (w,h) w=characters-wide, h=rows-high |
|
||||
| bool | auto_size_button | True if button size is determined by button text |
|
||||
|
@ -11325,7 +11350,6 @@ Parameter Descriptions:
|
|||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| int | border_width | width of border around element |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11359,6 +11383,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11397,6 +11422,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11438,10 +11464,10 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
Allows browsing of multiple files. File list is returned as a single list with the delimeter defined using the variable
|
||||
BROWSE_FILES_DELIMETER. This defaults to ';' but is changable by the user
|
||||
Allows browsing of multiple files. File list is returned as a single list with the delimiter defined using the files_delimiter parameter.
|
||||
|
||||
```
|
||||
FilesBrowse(button_text = "Browse",
|
||||
|
@ -11459,6 +11485,7 @@ FilesBrowse(button_text = "Browse",
|
|||
pad = None,
|
||||
key = None,
|
||||
k = None,
|
||||
files_delimiter = ";",
|
||||
metadata = None)
|
||||
```
|
||||
|
||||
|
@ -11480,6 +11507,8 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| str | files_delimiter | String to place between files when multiple files are selected. Normally a ; |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11517,6 +11546,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element |
|
||||
| str or int or tuple or object | key | Used with window.FindElement and with return values 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | The Button created
|
||||
|
||||
```
|
||||
|
@ -11550,6 +11580,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11583,6 +11614,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11617,6 +11649,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
Dumps an Object's values as a formatted string. Very nicely done. Great way to display an object's member variables in human form
|
||||
|
@ -11679,6 +11712,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11713,6 +11747,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11746,6 +11781,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11825,6 +11861,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11866,6 +11903,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11900,6 +11938,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -11933,6 +11972,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | focus | if focus should be set to this :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
## Button Functions No Longer Used (DO NOT USE)
|
||||
|
@ -12071,6 +12111,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
```
|
||||
|
@ -12114,6 +12155,7 @@ Parameter Descriptions:
|
|||
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element in pixels (left/right, top/bottom) |
|
||||
| str or int or tuple or object | key | key for uniquely identify this element (for window.FindElement) |
|
||||
| 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. |
|
||||
| Any | metadata | Anything you want to store along with this button |
|
||||
| (Button) | **RETURN** | returns a button
|
||||
|
||||
## Debug Window Output
|
||||
|
@ -12533,20 +12575,20 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str or bytes | image_source | Either a filename or a base64 string. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| str or bytes or None | image_source | Either a filename or a base64 string. Use None to close the window. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| None | **RETURN** | No return value
|
||||
|
||||
Popup that closes itself after some time period
|
||||
|
@ -12716,7 +12758,7 @@ Parameter Descriptions:
|
|||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| bool | close_when_chosen | MIKE_please_add_text_here |
|
||||
| bool | close_when_chosen | If True, the window will close and function return when a day is clicked |
|
||||
| str | locale | locale used to get the day names |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
|
@ -12748,6 +12790,7 @@ popup_get_file(message,
|
|||
location = (None, None),
|
||||
initial_folder = None,
|
||||
image = None,
|
||||
files_delimiter = ";",
|
||||
modal = True)
|
||||
```
|
||||
|
||||
|
@ -12775,6 +12818,7 @@ Parameter Descriptions:
|
|||
| Tuple[int, int] | location | Location of upper left corner of the window |
|
||||
| str | initial_folder | location in filesystem to begin browsing |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| str | files_delimiter | String to place between files when multiple files are selected. Normally a ; |
|
||||
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = True |
|
||||
| str or None | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
|
||||
|
||||
|
@ -13479,20 +13523,20 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str or bytes | image_source | Either a filename or a base64 string. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| str or bytes or None | image_source | Either a filename or a base64 string. Use None to close the window. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| None | **RETURN** | No return value
|
||||
|
||||
Display a Popup without a titlebar. Enables grab anywhere so you can move it
|
||||
|
@ -13700,6 +13744,7 @@ PopupGetFile(message,
|
|||
location = (None, None),
|
||||
initial_folder = None,
|
||||
image = None,
|
||||
files_delimiter = ";",
|
||||
modal = True)
|
||||
```
|
||||
|
||||
|
@ -13727,6 +13772,7 @@ Parameter Descriptions:
|
|||
| Tuple[int, int] | location | Location of upper left corner of the window |
|
||||
| str | initial_folder | location in filesystem to begin browsing |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| str | files_delimiter | String to place between files when multiple files are selected. Normally a ; |
|
||||
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = True |
|
||||
| str or None | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
|
||||
|
||||
|
@ -15043,7 +15089,10 @@ set_options(icon = None,
|
|||
titlebar_background_color = None,
|
||||
titlebar_text_color = None,
|
||||
titlebar_font = None,
|
||||
titlebar_icon = None)
|
||||
titlebar_icon = None,
|
||||
user_settings_path = None,
|
||||
pysimplegui_settings_path = None,
|
||||
pysimplegui_settings_filename = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
@ -15096,6 +15145,9 @@ Parameter Descriptions:
|
|||
| str or None | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| str or Tuple[str, int] or None | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| bytes or str | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| str | user_settings_path | default path for user_settings API calls. Expanded with os.path.expanduser so can contain ~ to represent user |
|
||||
| str | pysimplegui_settings_path | default path for the global PySimpleGUI user_settings |
|
||||
| str | pysimplegui_settings_filename | default filename for the global PySimpleGUI user_settings |
|
||||
| None | **RETURN** | None
|
||||
|
||||
### Non PEP8 versions
|
||||
|
@ -15160,7 +15212,10 @@ SetOptions(icon = None,
|
|||
titlebar_background_color = None,
|
||||
titlebar_text_color = None,
|
||||
titlebar_font = None,
|
||||
titlebar_icon = None)
|
||||
titlebar_icon = None,
|
||||
user_settings_path = None,
|
||||
pysimplegui_settings_path = None,
|
||||
pysimplegui_settings_filename = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
@ -15213,6 +15268,9 @@ Parameter Descriptions:
|
|||
| str or None | titlebar_text_color | If custom titlebar indicated by use_custom_titlebar, then use this as text color |
|
||||
| str or Tuple[str, int] or None | titlebar_font | If custom titlebar indicated by use_custom_titlebar, then use this as title font |
|
||||
| bytes or str | titlebar_icon | If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes) |
|
||||
| str | user_settings_path | default path for user_settings API calls. Expanded with os.path.expanduser so can contain ~ to represent user |
|
||||
| str | pysimplegui_settings_path | default path for the global PySimpleGUI user_settings |
|
||||
| str | pysimplegui_settings_filename | default filename for the global PySimpleGUI user_settings |
|
||||
| None | **RETURN** | None
|
||||
|
||||
## Old Themes (Look and Feel) - Replaced by theme()
|
||||
|
|
111
docs/index.md
111
docs/index.md
|
@ -1666,6 +1666,7 @@ popup_get_file(message,
|
|||
location = (None, None),
|
||||
initial_folder = None,
|
||||
image = None,
|
||||
files_delimiter = ";",
|
||||
modal = True)
|
||||
```
|
||||
|
||||
|
@ -1693,6 +1694,7 @@ Parameter Descriptions:
|
|||
| Tuple[int, int] | location | Location of upper left corner of the window |
|
||||
| str | initial_folder | location in filesystem to begin browsing |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| str | files_delimiter | String to place between files when multiple files are selected. Normally a ; |
|
||||
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = True |
|
||||
| str or None | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
|
||||
|
||||
|
@ -1805,20 +1807,20 @@ Parameter Descriptions:
|
|||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str or bytes | image_source | Either a filename or a base64 string. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| str or bytes or None | image_source | Either a filename or a base64 string. Use None to close the window. |
|
||||
| str | message | An optional message to be shown with the animation |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| str or tuple | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True then the titlebar and window frame will not be shown |
|
||||
| bool | grab_anywhere | If True then you can move the window just clicking anywhere on window, hold and drag |
|
||||
| bool | keep_on_top | If True then Window will remain on top of all other windows currently shownn |
|
||||
| (int, int) | location | (x,y) location on the screen to place the top left corner of your window. Default is to center on screen |
|
||||
| float | alpha_channel | Window transparency 0 = invisible 1 = completely visible. Values between are see through |
|
||||
| int | time_between_frames | Amount of time in milliseconds between each frame |
|
||||
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
|
||||
| str | title | Title that will be shown on the window |
|
||||
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
|
||||
| None | **RETURN** | No return value
|
||||
|
||||
***To close animated popups***, call PopupAnimated with `image_source=None`. This will close all of the currently open PopupAnimated windows.
|
||||
|
@ -6324,12 +6326,11 @@ Watch this space in the future for the more standardized variable name for this
|
|||
|
||||
If you wish to receive events directly from tkinter, but do it in a PySimpleGUI way, then you can do that and get those events returned to you via your standard `Window.read()` call.
|
||||
|
||||
Both the Elements and Window objects have a method called `bind`. You specify 2 parameters to this function. One is the string that is used to tell tkinter what events to bind. The other is a "key modifier" for Elements and a "key" for Windows.
|
||||
Both the Elements and Window objects have a method called `bind`. You specify 2 parameters to this function. One is the string that is used to tell tkinter what events to bind. The other is a "key modifier" for Elements and a "key" for Windows.
|
||||
|
||||
The `key_modifier` in the `Element.bind` call is something that is added to your key. If your key is a string, then this modifier will be appended to your key and the event will be a single string.
|
||||
|
||||
If your element's key is not a string, then a tuple will be returned as the event
|
||||
(your_key, key_modifier)
|
||||
If your element's key is not a string, then a tuple will be returned as the event (your_key, key_modifier)
|
||||
|
||||
This will enable you to continue to use your weird, non-string keys. Just be aware that you'll be getting back a tuple instead of your key in these situations.
|
||||
|
||||
|
@ -6337,15 +6338,65 @@ The best example of when this can happen is in a Minesweeper game where each but
|
|||
|
||||
It'll be tricky for the user to parse these events, but it's assumed you're an advanced user if you're using this capability and are also using non-string keys.
|
||||
|
||||
There are 2 member variables that have also been added as shown in the documentation for the bind methods. This added variable contains the tkinter specific event information. In other words, the 'event' that tkinter normally sends back when a callback happens.
|
||||
An Element member variable `user_bind_event` will contain information that tkinter passed back along with the event. It's not required for most operations and none of the demos currently use this variable, but it's there just in case. The contents of the variable are tkinter specific and set by tkinter so you'll be digging into the tkinter docs if you're using an obscure binding of some kind.
|
||||
|
||||
Here is sample code that shows how to make these calls.
|
||||
tkinter events must be in between angle brackets
|
||||
|
||||
Three events are being bound.
|
||||
```python
|
||||
window['-KEY-'].bind('<TKINTER EVENT>', 'STRING TO APPEND')
|
||||
```
|
||||
|
||||
Events can also be binded to the window
|
||||
```python
|
||||
window.bind('<TKINTER EVENT>', 'STRING TO APPEND')
|
||||
```
|
||||
|
||||
List of tkinter events:
|
||||
|
||||
| Event | Description |
|
||||
| :------------------------------- | ------------------------------------------------------------ |
|
||||
| Button-1 / ButtonPress-1 / 1 | Left button is pressed over an element. 1 corresponds to the left button, 2 to the middle button, 3 to the right button. <br>Buttons can go up to 5 |
|
||||
| ButtonRelease-1 | Left button is released over an element. |
|
||||
| Double-Button-1 | An element was double clicked. The 'Double' modifier was used. See below for more modifiers. |
|
||||
| B1-Motion | Left button is held and moved around over an element. |
|
||||
| Motion | Mouse pointer is moved over an element |
|
||||
| Enter | Mouse pointer entered the element |
|
||||
| Leave | Mouse pointer left the element |
|
||||
| Key / KeyPress<br>Keypress-a / a | A key was pressed. [Keysyms](https://www.tcl.tk/man/tcl8.6/TkCmd/keysyms.htm) can be used to bind specific key/s. <br>When using keysyms, 'Key' or 'KeyPress' can be omitted. <br> |
|
||||
| KeyReleased | A key was released. |
|
||||
| FocusIn | Keyboard has focused on element. |
|
||||
| FocusOut | Keyboard switched focus from element. |
|
||||
| Visibility | Some part of the element is seen on screen |
|
||||
|
||||
Modifier keys can be put in front of events.
|
||||
|
||||
| Windows | MacOS |
|
||||
| ------- | ------- |
|
||||
| Control | Command |
|
||||
| Alt | Option |
|
||||
| Shift |<==|
|
||||
| Double | <== |
|
||||
| Triple | <== |
|
||||
| Quadruple | <== |
|
||||
|
||||
The following will bind Ctrl+z to the window:
|
||||
```python
|
||||
window.bind('<Control-z>', 'STRING TO APPEND')
|
||||
```
|
||||
|
||||
To unbind an event from an element, use the `unbind` method.
|
||||
```python
|
||||
window['-KEY-'].unbind('TKINTER EVENT')
|
||||
```
|
||||
|
||||
Here is sample code that shows these bindings in action.
|
||||
|
||||
Four main things are occurring.
|
||||
|
||||
1. Any button clicks in the window will return an event "Window Click" from window.read()
|
||||
2. Right clicking the "Go" buttons will return an event "Go+RIGHT CLICK+" from window.read()
|
||||
3. When the Input Element receives focus, an event "-IN-+FOCUS+" will be returned from window.read()
|
||||
2. Right clicking the "Go" buttons will return an event "Go +RIGHT CLICK+" from window.read()
|
||||
3. When the second Input Element receives focus, an event "-IN2- +FOCUS+" will be returned from window.read()
|
||||
4. If the "Unbind " button is pressed, the right click binding of the "Go" button will be unbinded.
|
||||
|
||||
```python
|
||||
import PySimpleGUI as sg
|
||||
|
@ -6353,27 +6404,29 @@ import PySimpleGUI as sg
|
|||
sg.theme('Dark Green 2')
|
||||
|
||||
layout = [ [sg.Text('My Window')],
|
||||
[sg.Input(key='-IN-'), sg.Text(size=(15,1), key='-OUT-')],
|
||||
[sg.Button('Go'), sg.Button('Exit')]
|
||||
[sg.Input(key='-IN1-')],
|
||||
[sg.Input(key='-IN2-')],
|
||||
[sg.Button('Go'), sg.Button('Unbind'),sg.Button('Exit')]
|
||||
]
|
||||
|
||||
window = sg.Window('Window Title', layout, finalize=True)
|
||||
|
||||
window['-IN-'].bind("<FocusIn>", '+FOCUS+')
|
||||
window.bind("<Button-1>", 'Window Click')
|
||||
window['Go'].bind("<Button-3>", '+RIGHT CLICK+')
|
||||
window['Go'].bind("<Button-3>", ' +RIGHT CLICK+')
|
||||
window['-IN2-'].bind("<FocusIn>", ' +FOCUS+')
|
||||
|
||||
while True: # Event Loop
|
||||
event, values = window.read()
|
||||
print(event, values)
|
||||
if event in (sg.WIN_CLOSED, 'Exit'):
|
||||
break
|
||||
if event == 'Unbind':
|
||||
window['Go'].unbind('<Button-3>')
|
||||
|
||||
window.close(); del window
|
||||
window.close()
|
||||
```
|
||||
|
||||
There is no way to "unbind" and event at this time. (sorry, didn't think of it before releasing)
|
||||
---
|
||||
[Tkinter bindings documentation](https://tcl.tk/man/tcl8.6/TkCmd/bind.htm#M18)
|
||||
|
||||
------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue