Merge pull request #3766 from PySimpleGUI/Dev-latest
Release 4.33.0 (Welcome 2021!!)
This commit is contained in:
commit
e6251daa53
135
PySimpleGUI.py
135
PySimpleGUI.py
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
version = __version__ = "4.32.1.17 Unreleased\nRemoved faking timeout message as it can happen when autoclose used, CLOSE_ATTEMPED_EVENT, button_color can have a None parameter, fill_color added to draw_arc, 16x16 icon, Titlebar element, set_option gets custom titlebar option, tons of sh*t for custom titlebars, if running on Trinket then use custom titlebars by default, smarter titlebar handling..auto remove, added key to titlebar image, renamed InputText to Input, massive nngogol Union docstring fix!, finally custom titlebar minimize works on Linux and can also be pinned and made invisible, .visible added to all elements, dummy element.update so docstrings will be happier, custom titlebar global settings, custom titlebar window-level settings, spin fix in update by changing enable to normal"
|
||||
version = __version__ = "4.33.0 Released 02-Jan-2021"
|
||||
|
||||
__version__ = version.split()[0] # For PEP 396 and PEP 345
|
||||
|
||||
|
@ -277,6 +277,23 @@ def _running_windows():
|
|||
return sys.platform.startswith('win')
|
||||
|
||||
|
||||
def _running_trinket():
|
||||
"""
|
||||
A special case for Trinket. Checks both the OS and the number of environment variables
|
||||
Currently, Trinket only has ONE environment variable. This fact is used to figure out if Trinket is being used.
|
||||
|
||||
Returns True if "Trinket" (in theory)
|
||||
|
||||
:return: True if sys.platform indicates Linux and the number of environment variables is 1
|
||||
:rtype: (bool)
|
||||
"""
|
||||
if len(os.environ) == 1 and sys.platform.startswith('linux'):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
# Handy python statements to increment and decrement with wrapping that I don't want to forget
|
||||
# count = (count + (MAX - 1)) % MAX # Decrement - roll over to MAX from 0
|
||||
# count = (count + 1) % MAX # Increment to MAX then roll over to 0
|
||||
|
@ -759,7 +776,7 @@ class Element():
|
|||
self.Key = key # dictionary key for return values
|
||||
self.Tooltip = tooltip
|
||||
self.TooltipObject = None
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
self.TKRightClickMenu = None
|
||||
self.Widget = None # Set when creating window. Has the main tkinter widget for element
|
||||
self.Tearoff = False # needed because of right click menu code
|
||||
|
@ -773,6 +790,18 @@ class Element():
|
|||
if not hasattr(self, 'ItemFont'):
|
||||
self.ItemFont = None
|
||||
|
||||
|
||||
@property
|
||||
def visible(self):
|
||||
"""
|
||||
Returns visibility state for the element. This is a READONLY property
|
||||
To control visibility, use the element's update method
|
||||
:return: Visibility state for element
|
||||
:rtype: (bool)
|
||||
"""
|
||||
return self._visible
|
||||
|
||||
|
||||
def _RightClickMenuCallback(self, event):
|
||||
"""
|
||||
Callback function that's called when a right click happens. Shows right click menu as result
|
||||
|
@ -783,6 +812,7 @@ class Element():
|
|||
self.TKRightClickMenu.tk_popup(event.x_root, event.y_root, 0)
|
||||
self.TKRightClickMenu.grab_release()
|
||||
|
||||
|
||||
def _MenuItemChosenCallback(self, item_chosen): # TEXT Menu item callback
|
||||
"""
|
||||
Callback function called when user chooses a menu item from menubar, Button Menu or right click menu
|
||||
|
@ -799,6 +829,7 @@ class Element():
|
|||
# Window._window_that_exited = self.ParentForm
|
||||
# self.ParentForm.TKroot.quit() # kick the users out of the mainloop
|
||||
|
||||
|
||||
def _FindReturnKeyBoundButton(self, form):
|
||||
"""
|
||||
Searches for which Button has the flag Button.BindReturnKey set. It is called recursively when a
|
||||
|
@ -835,6 +866,7 @@ class Element():
|
|||
return rc
|
||||
return None
|
||||
|
||||
|
||||
def _TextClickedHandler(self, event):
|
||||
"""
|
||||
Callback that's called when a text element is clicked on with events enabled on the Text Element.
|
||||
|
@ -989,6 +1021,7 @@ class Element():
|
|||
"""
|
||||
self._generic_callback_handler('')
|
||||
|
||||
|
||||
def _user_bind_callback(self, bind_string, event):
|
||||
"""
|
||||
Used when user binds a tkinter event directly to an element
|
||||
|
@ -1009,6 +1042,7 @@ class Element():
|
|||
|
||||
self._generic_callback_handler(force_key_to_be=key)
|
||||
|
||||
|
||||
def bind(self, bind_string, key_modifier):
|
||||
"""
|
||||
Used to add tkinter events to an Element.
|
||||
|
@ -1093,6 +1127,7 @@ class Element():
|
|||
except:
|
||||
print('Warning, error setting height on element with key=', self.Key)
|
||||
|
||||
|
||||
def get_size(self):
|
||||
"""
|
||||
Return the size of an element in Pixels. Care must be taken as some elements use characters to specify their size but will return pixels when calling this get_size method.
|
||||
|
@ -1107,6 +1142,7 @@ class Element():
|
|||
w = h = None
|
||||
return w, h
|
||||
|
||||
|
||||
def hide_row(self):
|
||||
"""
|
||||
Hide the entire row an Element is located on.
|
||||
|
@ -1117,6 +1153,7 @@ class Element():
|
|||
except:
|
||||
print('Warning, error hiding element row for key =', self.Key)
|
||||
|
||||
|
||||
def unhide_row(self):
|
||||
"""
|
||||
Unhides (makes visible again) the row container that the Element is located on.
|
||||
|
@ -1166,6 +1203,7 @@ class Element():
|
|||
print('Warning bad cursor specified ', cursor)
|
||||
print(e)
|
||||
|
||||
|
||||
def set_vscroll_position(self, percent_from_top):
|
||||
"""
|
||||
Attempts to set the vertical scroll postition for an element's Widget
|
||||
|
@ -1370,7 +1408,7 @@ class Input(Element):
|
|||
self.TKEntry.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
# self.TKEntry.pack(padx=self.pad_used[0], pady=self.pad_used[1], in_=self.ParentRowFrame)
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
|
||||
def Get(self):
|
||||
|
@ -1524,7 +1562,7 @@ class Combo(Element):
|
|||
elif visible is True:
|
||||
self.TKCombo.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def Get(self):
|
||||
"""
|
||||
|
@ -1650,7 +1688,7 @@ class OptionMenu(Element):
|
|||
elif visible is True:
|
||||
self.TKOptionMenu.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
set_focus = Element.SetFocus
|
||||
set_tooltip = Element.SetTooltip
|
||||
|
@ -1803,7 +1841,7 @@ class Listbox(Element):
|
|||
except:
|
||||
print('Listbox.update error trying to change mode to: ', select_mode)
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def SetValue(self, values):
|
||||
"""
|
||||
|
@ -2008,7 +2046,7 @@ class Radio(Element):
|
|||
elif visible is True:
|
||||
self.TKRadio.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def ResetGroup(self):
|
||||
"""
|
||||
|
@ -2183,7 +2221,7 @@ class Checkbox(Element):
|
|||
elif visible is True:
|
||||
self.TKCheckbutton.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
get = Get
|
||||
set_focus = Element.SetFocus
|
||||
|
@ -2314,7 +2352,7 @@ class Spin(Element):
|
|||
elif visible is True:
|
||||
self.TKSpinBox.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def _SpinChangedHandler(self, event):
|
||||
"""
|
||||
|
@ -2561,7 +2599,7 @@ class Multiline(Element):
|
|||
except:
|
||||
pass
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
|
||||
def Get(self):
|
||||
|
@ -2771,7 +2809,7 @@ class Text(Element):
|
|||
elif visible is True:
|
||||
self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def Get(self):
|
||||
"""
|
||||
|
@ -2895,7 +2933,7 @@ class StatusBar(Element):
|
|||
elif visible is True:
|
||||
self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
set_focus = Element.SetFocus
|
||||
set_tooltip = Element.SetTooltip
|
||||
|
@ -3185,7 +3223,7 @@ class Output(Element):
|
|||
elif visible is True:
|
||||
self._TKOut.frame.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def Get(self):
|
||||
"""
|
||||
|
@ -3735,7 +3773,7 @@ class Button(Element):
|
|||
disabled_button_color[1] if disabled_button_color[1] is not None else self.DisabledButtonColor[1])
|
||||
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
|
||||
def GetText(self):
|
||||
|
@ -3895,7 +3933,7 @@ class ButtonMenu(Element):
|
|||
elif visible is True:
|
||||
self.TKButtonMenu.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def Click(self):
|
||||
"""
|
||||
|
@ -4028,7 +4066,7 @@ class ProgressBar(Element):
|
|||
elif visible is True:
|
||||
self.TKProgressBar.TKProgressBarForReal.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
self.TKProgressBar.Update(current_count, max=max)
|
||||
try:
|
||||
|
@ -4153,7 +4191,7 @@ class Image(Element):
|
|||
if filename is None and image is None and visible is None and size == (None, None):
|
||||
self.tktext_label.image = None
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
|
||||
def UpdateAnimation(self, source, time_between_frames=0):
|
||||
|
@ -4811,7 +4849,7 @@ class Graph(Element):
|
|||
elif visible is True:
|
||||
self._TKCanvas2.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def Move(self, x_direction, y_direction):
|
||||
"""
|
||||
|
@ -5225,7 +5263,7 @@ class Frame(Element):
|
|||
if value is not None:
|
||||
self.TKFrame.config(text=str(value))
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
add_row = AddRow
|
||||
layout = Layout
|
||||
|
@ -5463,7 +5501,7 @@ class Tab(Element):
|
|||
if visible is False:
|
||||
state = 'hidden'
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
self.ParentNotebook.tab(self.TabID, state=state)
|
||||
|
||||
|
@ -5833,7 +5871,7 @@ class Slider(Element):
|
|||
if range != (None, None):
|
||||
self.TKScale.config(from_=range[0], to_=range[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def _SliderChangedHandler(self, event):
|
||||
"""
|
||||
|
@ -6189,7 +6227,7 @@ class Column(Element):
|
|||
if self.ParentPanedWindow:
|
||||
self.ParentPanedWindow.add(self.TKColFrame)
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def contents_changed(self):
|
||||
"""
|
||||
|
@ -6287,7 +6325,7 @@ class Pane(Element):
|
|||
elif visible is True:
|
||||
self.PanedWindow.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
set_focus = Element.SetFocus
|
||||
set_tooltip = Element.SetTooltip
|
||||
|
@ -6638,7 +6676,7 @@ class Menu(Element):
|
|||
elif self.TKMenu is not None:
|
||||
self.ParentForm.TKroot.configure(menu=self.TKMenu)
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
set_focus = Element.SetFocus
|
||||
set_tooltip = Element.SetTooltip
|
||||
|
@ -6854,7 +6892,7 @@ class Table(Element):
|
|||
else:
|
||||
self.TKTreeview.tag_configure(row_def[0], background=row_def[2], foreground=row_def[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
def _treeview_selected(self, event):
|
||||
"""
|
||||
|
@ -7154,7 +7192,7 @@ class Tree(Element):
|
|||
elif visible is True:
|
||||
self.TKTreeview.pack(padx=self.pad_used[0], pady=self.pad_used[1])
|
||||
if visible is not None:
|
||||
self.visible = visible
|
||||
self._visible = visible
|
||||
|
||||
return self
|
||||
|
||||
|
@ -8780,7 +8818,7 @@ class Window:
|
|||
self.TKrootDestroyed = True
|
||||
self.XFound = True
|
||||
else:
|
||||
self.LastButtonClicked = '-WINDOW CLOSE ATTEMPTED-'
|
||||
self.LastButtonClicked = WINDOW_CLOSE_ATTEMPTED_EVENT
|
||||
elif Window._root_running_mainloop == Window.hidden_master_root:
|
||||
_exit_mainloop(self)
|
||||
else:
|
||||
|
@ -8788,7 +8826,7 @@ class Window:
|
|||
self.TKroot.destroy() # destroy this window
|
||||
self.XFound = True
|
||||
else:
|
||||
self.LastButtonClicked = '-WINDOW CLOSE ATTEMPTED-'
|
||||
self.LastButtonClicked = WINDOW_CLOSE_ATTEMPTED_EVENT
|
||||
if self.close_destroys_window:
|
||||
self.RootNeedsDestroying = True
|
||||
|
||||
|
@ -8863,7 +8901,8 @@ class Window:
|
|||
def AlphaChannel(self):
|
||||
"""
|
||||
A property that changes the current alpha channel value (internal value)
|
||||
:return: (float) the current alpha channel setting according to self, not read directly from tkinter
|
||||
:return: the current alpha channel setting according to self, not read directly from tkinter
|
||||
:rtype: (float)
|
||||
"""
|
||||
return self._AlphaChannel
|
||||
|
||||
|
@ -9277,7 +9316,8 @@ class Window:
|
|||
|
||||
:param key: The key to find
|
||||
:type key: str | int | tuple | object""
|
||||
:rtype: Element |"""
|
||||
:rtype: Element | None
|
||||
"""
|
||||
|
||||
return self.FindElement(key)
|
||||
|
||||
|
@ -11291,14 +11331,6 @@ def _BuildResultsForSubform(form, initialize_only, top_level_form):
|
|||
AddToReturnList(form, value)
|
||||
form.ReturnValuesDictionary[event] = value
|
||||
|
||||
# This is SO dodgy.... if the Titlebar element's X was clicked, act like the real window was closed
|
||||
# if not initialize_only and event == TITLEBAR_CLOSE_KEY and form == top_level_form:
|
||||
# form._OnClosingCallback()
|
||||
# if form.close_destroys_window:
|
||||
# event = WINDOW_CLOSED
|
||||
# else:
|
||||
# event = WINDOW_CLOSE_ATTEMPTED_EVENT
|
||||
|
||||
if not form.UseDictionary:
|
||||
form.ReturnValues = event, form.ReturnValuesList
|
||||
else:
|
||||
|
@ -13253,19 +13285,6 @@ def _convert_window_to_tk(window):
|
|||
master = window.TKroot
|
||||
master.title(window.Title)
|
||||
InitializeResults(window)
|
||||
# try:
|
||||
# if window.NoTitleBar:
|
||||
# if sys.platform == 'linux':
|
||||
# window.TKroot.wm_attributes("-type", "splash")
|
||||
# else:
|
||||
# window.TKroot.wm_overrideredirect(True)
|
||||
# # Special case for Mac. Need to clear flag again if not tkinter version 8.6.10+
|
||||
# if sys.platform.startswith('darwin') and ENABLE_MAC_NOTITLEBAR_PATCH and (sum([int(i) for i in tclversion_detailed.split('.')]) < 24):
|
||||
# print('* Applying Mac no_titlebar patch *')
|
||||
# window.TKroot.wm_overrideredirect(False)
|
||||
# except:
|
||||
# print('** Problem setting no titlebar **')
|
||||
# pass
|
||||
|
||||
PackFormIntoFrame(window, master, window)
|
||||
|
||||
|
@ -17915,14 +17934,14 @@ def _copy_files_from_github(files, github_url=None):
|
|||
|
||||
"""
|
||||
|
||||
class ReturnInfo:
|
||||
class _ReturnInfo:
|
||||
src = ""
|
||||
package = ""
|
||||
new_files = ""
|
||||
path = ""
|
||||
version = ""
|
||||
|
||||
info = ReturnInfo()
|
||||
info = _ReturnInfo()
|
||||
info.src = files[0]
|
||||
info.package = path_stem(files[0])
|
||||
|
||||
|
@ -17959,7 +17978,7 @@ def _copy_files_from_github(files, github_url=None):
|
|||
page_contents["__init__.py"] = ("from ." + info.package + " import *\n").encode()
|
||||
if version != "unknown":
|
||||
page_contents["__init__.py"] += ("from ." + info.package + " import __version__\n").encode()
|
||||
if sys.platform.startswith("linux") or (sys.platform == "ios"):
|
||||
if _running_linux() or _running_mac():
|
||||
dir_search = sys.path
|
||||
else:
|
||||
dir_search = site.getsitepackages()
|
||||
|
@ -17971,7 +17990,7 @@ def _copy_files_from_github(files, github_url=None):
|
|||
else:
|
||||
raise ModuleNotFoundError("Unable to find site-packages folder!")
|
||||
|
||||
path = str(sitepackages_path) + "\\" + str(info.package)
|
||||
path = os.path.join(str(sitepackages_path), str(info.package))
|
||||
info.path = str(path)
|
||||
|
||||
if (os.path.isfile(path)):
|
||||
|
@ -17981,10 +18000,10 @@ def _copy_files_from_github(files, github_url=None):
|
|||
os.mkdir(path)
|
||||
|
||||
for file, contents in page_contents.items():
|
||||
with open(str(path) + "/" + str(file), "wb") as f:
|
||||
with open(os.path.join(str(path), str(file)), "wb") as f:
|
||||
f.write(contents)
|
||||
|
||||
if (sys.platform == "ios"):
|
||||
if _running_mac():
|
||||
pypi_packages = str(sitepackages_path) + "/.pypi_packages"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(pypi_packages)
|
||||
|
@ -18433,7 +18452,7 @@ test = main
|
|||
theme(CURRENT_LOOK_AND_FEEL)
|
||||
|
||||
# See if running on Trinket. If Trinket, then use custom titlebars since Trinket doesn't supply any
|
||||
if len(os.environ) == 1:
|
||||
if _running_trinket():
|
||||
USE_CUSTOM_TITLEBAR = True
|
||||
|
||||
if tclversion_detailed.startswith('8.5'):
|
||||
|
|
File diff suppressed because it is too large
Load Diff
589
docs/index.md
589
docs/index.md
|
@ -1434,52 +1434,52 @@ Popup - Display a popup Window with as many parms as you wish to include. This
|
|||
|
||||
```
|
||||
Popup(args=*<1 or N object>,
|
||||
title=None,
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
button_type=0,
|
||||
auto_close=False,
|
||||
auto_close_duration=None,
|
||||
custom_text=(None, None),
|
||||
non_blocking=False,
|
||||
icon=None,
|
||||
line_width=None,
|
||||
font=None,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
location=(None, None),
|
||||
any_key_closes=False,
|
||||
image=None,
|
||||
modal=True)
|
||||
title = None,
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
button_type = 0,
|
||||
auto_close = False,
|
||||
auto_close_duration = None,
|
||||
custom_text = (None, None),
|
||||
non_blocking = False,
|
||||
icon = None,
|
||||
line_width = None,
|
||||
font = None,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
location = (None, None),
|
||||
any_key_closes = False,
|
||||
image = None,
|
||||
modal = True)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| Any | *args | Variable number of your arguments. Load up the call with stuff to see! |
|
||||
| str | title | Optional title for the window. If none provided, the first arg will be used instead. |
|
||||
| Union[Tuple[str, str], None] | button_color | Color of the buttons shown (text color, button color) |
|
||||
| str | background_color | Window's background color |
|
||||
| str | text_color | text color |
|
||||
| int | button_type | NOT USER SET! Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). There are many Popup functions and they call Popup, changing this parameter to get the desired effect. |
|
||||
| bool | auto_close | If True the window will automatically close |
|
||||
| int | auto_close_duration | time in seconds to keep window open before closing it automatically |
|
||||
| Union[Tuple[str, str], str] | custom_text | A string or pair of strings that contain the text to display on the buttons |
|
||||
| bool | non_blocking | If True then will immediately return from the function without waiting for the user's input. |
|
||||
| Union[str, bytes] | icon | icon to display on the window. Same format as a Window call |
|
||||
| int | line_width | Width of lines in characters. Defaults to MESSAGE_BOX_LINE_WIDTH |
|
||||
| Union[str, tuple(font name, size, modifiers] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True will not show the frame around the window and the titlebar across the top |
|
||||
| bool | grab_anywhere | If True can grab anywhere to move the window. If no_titlebar is True, grab_anywhere should likely be enabled too |
|
||||
| Tuple[int, int] | location | Location on screen to display the top left corner of window. Defaults to window centered on screen |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. |
|
||||
| str) or (bytes | image | Image to include at the top of the popup window |
|
||||
| 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 |
|
||||
| Union[str, None] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
|
||||
| Any | *args | Variable number of your arguments. Load up the call with stuff to see! |
|
||||
| str | title | Optional title for the window. If none provided, the first arg will be used instead. |
|
||||
| Tuple[str, str] or None | button_color | Color of the buttons shown (text color, button color) |
|
||||
| str | background_color | Window's background color |
|
||||
| str | text_color | text color |
|
||||
| int | button_type | NOT USER SET! Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). There are many Popup functions and they call Popup, changing this parameter to get the desired effect. |
|
||||
| bool | auto_close | If True the window will automatically close |
|
||||
| int | auto_close_duration | time in seconds to keep window open before closing it automatically |
|
||||
| Tuple[str, str] or str | custom_text | A string or pair of strings that contain the text to display on the buttons |
|
||||
| bool | non_blocking | If True then will immediately return from the function without waiting for the user's input. |
|
||||
| str or bytes | icon | icon to display on the window. Same format as a Window call |
|
||||
| int | line_width | Width of lines in characters. Defaults to MESSAGE_BOX_LINE_WIDTH |
|
||||
| str or Tuple[font_name, size, modifiers] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True will not show the frame around the window and the titlebar across the top |
|
||||
| bool | grab_anywhere | If True can grab anywhere to move the window. If no_titlebar is True, grab_anywhere should likely be enabled too |
|
||||
| Tuple[int, int] | location | Location on screen to display the top left corner of window. Defaults to window centered on screen |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| 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** | Returns text of the button that was pressed. None will be returned if user closed window with X
|
||||
|
||||
The other output Popups are variations on parameters. Usually the button_type parameter is the primary one changed.
|
||||
|
||||
|
@ -1504,46 +1504,46 @@ want, just like a print statement.
|
|||
|
||||
```
|
||||
popup_scrolled(args=*<1 or N object>,
|
||||
title=None,
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
yes_no=False,
|
||||
auto_close=False,
|
||||
auto_close_duration=None,
|
||||
size=(None, None),
|
||||
location=(None, None),
|
||||
non_blocking=False,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
font=None,
|
||||
image=None,
|
||||
modal=True)
|
||||
title = None,
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
yes_no = False,
|
||||
auto_close = False,
|
||||
auto_close_duration = None,
|
||||
size = (None, None),
|
||||
location = (None, None),
|
||||
non_blocking = False,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
font = None,
|
||||
image = None,
|
||||
modal = True)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| Any | *args | Variable number of items to display |
|
||||
| str | title | Title to display in the window. |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| bool | yes_no | If True, displays Yes and No buttons instead of Ok |
|
||||
| bool | auto_close | if True window will close itself |
|
||||
| Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
|
||||
| (int, int) | size | (w,h) w=characters-wide, h=rows-high |
|
||||
| Tuple[int, int] | location | Location on the screen to place the upper left corner of the window |
|
||||
| bool | non_blocking | if True the call will immediately return rather than waiting on user input |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True, than can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
|
||||
| str) or (bytes | image | Image to include at the top of the popup window |
|
||||
| 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 |
|
||||
| Union[str, None, TIMEOUT_KEY] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
|
||||
| Any | *args | Variable number of items to display |
|
||||
| str | title | Title to display in the window. |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| bool | yes_no | If True, displays Yes and No buttons instead of Ok |
|
||||
| bool | auto_close | if True window will close itself |
|
||||
| int or float | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
|
||||
| (int, int) | size | (w,h) w=characters-wide, h=rows-high |
|
||||
| Tuple[int, int] | location | Location on the screen to place the upper left corner of the window |
|
||||
| bool | non_blocking | if True the call will immediately return rather than waiting on user input |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True, than can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| str or Tuple[str, int] | font | specifies the font family, size, etc |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| 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 or TIMEOUT_KEY | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
|
||||
|
||||
Typical usage:
|
||||
|
||||
|
@ -1569,47 +1569,47 @@ Show Popup window and immediately return (does not block)
|
|||
|
||||
```
|
||||
popup_no_wait(args=*<1 or N object>,
|
||||
title=None,
|
||||
button_type=0,
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
auto_close=False,
|
||||
auto_close_duration=None,
|
||||
non_blocking=True,
|
||||
icon=None,
|
||||
line_width=None,
|
||||
font=None,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
location=(None, None),
|
||||
image=None,
|
||||
modal=False)
|
||||
title = None,
|
||||
button_type = 0,
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
auto_close = False,
|
||||
auto_close_duration = None,
|
||||
non_blocking = True,
|
||||
icon = None,
|
||||
line_width = None,
|
||||
font = None,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
location = (None, None),
|
||||
image = None,
|
||||
modal = False)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| Any | *args | Variable number of items to display |
|
||||
| str | title | Title to display in the window. |
|
||||
| int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | auto_close | if True window will close itself |
|
||||
| Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
|
||||
| bool | non_blocking | if True the call will immediately return rather than waiting on user input |
|
||||
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
|
||||
| int | line_width | Width of lines in characters |
|
||||
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| Tuple[int, int] | location | Location of upper left corner of the window |
|
||||
| str) or (bytes | image | Image to include at the top of the popup window |
|
||||
| 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 = False |
|
||||
| Union[str, None] | **RETURN** | Reason for popup closing
|
||||
| Any | *args | Variable number of items to display |
|
||||
| str | title | Title to display in the window. |
|
||||
| int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bool | auto_close | if True window will close itself |
|
||||
| int or float | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
|
||||
| bool | non_blocking | if True the call will immediately return rather than waiting on user input |
|
||||
| bytes or str | icon | filename or base64 string to be used for the window's icon |
|
||||
| int | line_width | Width of lines in characters |
|
||||
| str or Tuple[str, int] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| Tuple[int, int] | location | Location of upper left corner of the window |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| 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 = False |
|
||||
| str or None | **RETURN** | Reason for popup closing
|
||||
|
||||
The `popup` call `popup_no_wait` or `popup_non_blocking` will create a popup window and then immediately return control back to you. You can turn other popup calls into non-blocking popups if they have a `non_blocking` parameter. Setting `non_blocking` to True will cause the function to return immediately rather than waiting for the window to be closed.
|
||||
|
||||
|
@ -1636,44 +1636,44 @@ Display Popup with text entry field. Returns the text entered or None if closed
|
|||
|
||||
```
|
||||
popup_get_text(message,
|
||||
title=None,
|
||||
default_text="",
|
||||
password_char="",
|
||||
size=(None, None),
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
icon=None,
|
||||
font=None,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
location=(None, None),
|
||||
image=None,
|
||||
modal=True)
|
||||
title = None,
|
||||
default_text = "",
|
||||
password_char = "",
|
||||
size = (None, None),
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
icon = None,
|
||||
font = None,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
location = (None, None),
|
||||
image = None,
|
||||
modal = True)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_text | default value to put into input area |
|
||||
| str | password_char | character to be shown instead of actually typed characters |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | Color of the button (text, background) |
|
||||
| str | background_color | background color of the entire window |
|
||||
| str | text_color | color of the message text |
|
||||
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
|
||||
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True can click and drag anywhere in the window to move the window |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window |
|
||||
| str) or (bytes | image | Image to include at the top of the popup window |
|
||||
| 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 |
|
||||
| Union[str, None] | **RETURN** | Text entered or None if window was closed or cancel button clicked
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_text | default value to put into input area |
|
||||
| str | password_char | character to be shown instead of actually typed characters |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | Color of the button (text, background) |
|
||||
| str | background_color | background color of the entire window |
|
||||
| str | text_color | color of the message text |
|
||||
| bytes or str | icon | filename or base64 string to be used for the window's icon |
|
||||
| str or Tuple[str, int] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True can click and drag anywhere in the window to move the window |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window |
|
||||
| str or bytes | image | Image to include at the top of the popup window |
|
||||
| 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** | Text entered or None if window was closed or cancel button clicked
|
||||
|
||||
```python
|
||||
import PySimpleGUI as sg
|
||||
|
@ -1693,54 +1693,54 @@ Display popup window with text entry field and browse button so that a file can
|
|||
|
||||
```
|
||||
popup_get_file(message,
|
||||
title=None,
|
||||
default_path="",
|
||||
default_extension="",
|
||||
save_as=False,
|
||||
multiple_files=False,
|
||||
file_types=(('ALL Files', '*.*'),),
|
||||
no_window=False,
|
||||
size=(None, None),
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
icon=None,
|
||||
font=None,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
location=(None, None),
|
||||
initial_folder=None,
|
||||
image=None,
|
||||
modal=True)
|
||||
title = None,
|
||||
default_path = "",
|
||||
default_extension = "",
|
||||
save_as = False,
|
||||
multiple_files = False,
|
||||
file_types = (('ALL Files', '*.*'),),
|
||||
no_window = False,
|
||||
size = (None, None),
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
icon = None,
|
||||
font = None,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
location = (None, None),
|
||||
initial_folder = None,
|
||||
image = None,
|
||||
modal = True)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_path | path to display to user as starting point (filled into the input field) |
|
||||
| str | default_extension | If no extension entered by user, add this to filename (only used in saveas dialogs) |
|
||||
| bool | save_as | if True, the "save as" dialog is shown which will verify before overwriting |
|
||||
| bool | multiple_files | if True, then allows multiple files to be selected that are returned with ';' between each filename |
|
||||
| Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) |
|
||||
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | Color of the button (text, background) |
|
||||
| str | background_color | background color of the entire window |
|
||||
| str | text_color | color of the text |
|
||||
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
|
||||
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| Union[str, None] | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_path | path to display to user as starting point (filled into the input field) |
|
||||
| str | default_extension | If no extension entered by user, add this to filename (only used in saveas dialogs) |
|
||||
| bool | save_as | if True, the "save as" dialog is shown which will verify before overwriting |
|
||||
| bool | multiple_files | if True, then allows multiple files to be selected that are returned with ';' between each filename |
|
||||
| Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) |
|
||||
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | Color of the button (text, background) |
|
||||
| str | background_color | background color of the entire window |
|
||||
| str | text_color | color of the text |
|
||||
| bytes or str | icon | filename or base64 string to be used for the window's icon |
|
||||
| str or Tuple[str, int] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| 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 |
|
||||
| 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
|
||||
|
||||
If configured as an Open File Popup then (save_as is not True) the dialog box will look like this.
|
||||
|
||||
|
@ -1769,46 +1769,46 @@ Display popup with text entry field and browse button so that a folder can be ch
|
|||
|
||||
```
|
||||
popup_get_folder(message,
|
||||
title=None,
|
||||
default_path="",
|
||||
no_window=False,
|
||||
size=(None, None),
|
||||
button_color=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
icon=None,
|
||||
font=None,
|
||||
no_titlebar=False,
|
||||
grab_anywhere=False,
|
||||
keep_on_top=False,
|
||||
location=(None, None),
|
||||
initial_folder=None,
|
||||
image=None,
|
||||
modal=True)
|
||||
title = None,
|
||||
default_path = "",
|
||||
no_window = False,
|
||||
size = (None, None),
|
||||
button_color = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
icon = None,
|
||||
font = None,
|
||||
no_titlebar = False,
|
||||
grab_anywhere = False,
|
||||
keep_on_top = False,
|
||||
location = (None, None),
|
||||
initial_folder = None,
|
||||
image = None,
|
||||
modal = True)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_path | path to display to user as starting point (filled into the input field) |
|
||||
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
|
||||
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| Union[str, None] | **RETURN** | string representing the path chosen, None if cancelled or window closed with X
|
||||
| str | message | message displayed to user |
|
||||
| str | title | Window title |
|
||||
| str | default_path | path to display to user as starting point (filled into the input field) |
|
||||
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
|
||||
| (int, int) | size | (width, height) of the InputText Element |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| str | background_color | color of background |
|
||||
| str | text_color | color of the text |
|
||||
| bytes or str | icon | filename or base64 string to be used for the window's icon |
|
||||
| str or Tuple[str, int] | font | specifies the font family, size, etc |
|
||||
| bool | no_titlebar | If True no titlebar will be shown |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | keep_on_top | If True the window will remain above all current windows |
|
||||
| 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 |
|
||||
| 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 path chosen, None if cancelled or window closed with X
|
||||
|
||||
This is a typical call
|
||||
|
||||
|
@ -1832,39 +1832,39 @@ Show animation one frame at a time. This function has its own internal clocking
|
|||
|
||||
```
|
||||
popup_animated(image_source,
|
||||
message=None,
|
||||
background_color=None,
|
||||
text_color=None,
|
||||
font=None,
|
||||
no_titlebar=True,
|
||||
grab_anywhere=True,
|
||||
keep_on_top=True,
|
||||
location=(None, None),
|
||||
alpha_channel=None,
|
||||
time_between_frames=0,
|
||||
transparent_color=None,
|
||||
title="",
|
||||
icon=None)
|
||||
message = None,
|
||||
background_color = None,
|
||||
text_color = None,
|
||||
font = None,
|
||||
no_titlebar = True,
|
||||
grab_anywhere = True,
|
||||
keep_on_top = True,
|
||||
location = (None, None),
|
||||
alpha_channel = None,
|
||||
time_between_frames = 0,
|
||||
transparent_color = None,
|
||||
title = "",
|
||||
icon = None)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| Union[str, 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 |
|
||||
| Union[str, 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 | 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 |
|
||||
| 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.
|
||||
|
@ -1876,33 +1876,33 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr
|
|||
one_line_progress_meter(title,
|
||||
current_value,
|
||||
max_value,
|
||||
key="OK for 1 meter",
|
||||
key = "OK for 1 meter",
|
||||
args=*<1 or N object>,
|
||||
orientation="v",
|
||||
bar_color=(None, None),
|
||||
button_color=None,
|
||||
size=(20, 20),
|
||||
border_width=None,
|
||||
grab_anywhere=False,
|
||||
no_titlebar=False)
|
||||
orientation = "v",
|
||||
bar_color = (None, None),
|
||||
button_color = None,
|
||||
size = (20, 20),
|
||||
border_width = None,
|
||||
grab_anywhere = False,
|
||||
no_titlebar = False)
|
||||
```
|
||||
|
||||
Parameter Descriptions:
|
||||
|
||||
|Type|Name|Meaning|
|
||||
|--|--|--|
|
||||
| str | title | text to display in eleemnt |
|
||||
| int | current_value | current value |
|
||||
| int | max_value | max value of QuickMeter |
|
||||
| Union[str, int, tuple, object] | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters |
|
||||
| Any | *args | stuff to output |
|
||||
| str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') |
|
||||
| Tuple(str, str) | bar_color | color of a bar line |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) |
|
||||
| int | border_width | width of border around element |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | no_titlebar | If True: no titlebar will be shown on the window |
|
||||
| str | title | text to display in eleemnt |
|
||||
| int | current_value | current value |
|
||||
| int | max_value | max value of QuickMeter |
|
||||
| str or int or tuple or object | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters |
|
||||
| Any | *args | stuff to output |
|
||||
| str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') |
|
||||
| Tuple(str, str) | bar_color | color of a bar line |
|
||||
| Tuple[str, str] or str | button_color | button color (foreground, background) |
|
||||
| (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) |
|
||||
| int | border_width | width of border around element |
|
||||
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
|
||||
| bool | no_titlebar | If True: no titlebar will be shown on the window |
|
||||
| (bool) | **RETURN** | True if updated successfully. False if user closed the meter with the X or Cancel button
|
||||
|
||||
Here's the one-line Progress Meter in action!
|
||||
|
@ -8203,6 +8203,67 @@ Menu colors and font, fixes
|
|||
|
||||
* Bug in finalize code
|
||||
|
||||
## 4.33.0 PySimpleGUI 2-Jan-2021 (Happy New Year!)
|
||||
|
||||
The let's kickoff 2021 release!
|
||||
|
||||
Custom Titlebars, Fix for Docstrings so PyCharm 2020 works correctly, New shortcuts, Window Close Attempted
|
||||
|
||||
* Custom Titlebar - new element
|
||||
* Initial reason was Trinket, but great feature overall
|
||||
* Allows windows to be styled to match the colors of the window
|
||||
* Automatically uses theme for colors
|
||||
* Automatically used when running on Trinket
|
||||
* Can specify using them by using set_options, a Titlebar element, or parameters in Window creation
|
||||
* Documentation is coming soonish
|
||||
* Demo exists showing how to use (it's enough that you won't need a Cookbook / detailed docs to add it to your own program)
|
||||
* Changes include adding a 16x16 pixel version of the PySimpleGUI icon
|
||||
* popups - If custom titlebar is set using set_options (and is thus globally applied) then popups will use the custom titlebar
|
||||
* MASSIVE number of changes to docstrings so that PyCharm again works correctly. All Unions had to be changed to use "|" instead
|
||||
* Internal functions added to check what OS is being used rather than having os.platform checks all over thee place
|
||||
* Element.Visible removed. Element.visible property returns current visibility state for element
|
||||
* This is a read-only property
|
||||
* Added dummy Element.update method so that PyCharm doesn't complain about a missing method
|
||||
* InputElement class changed to Input. Both will work as InputElement is now an alias
|
||||
* Fix in Spin.update. Was using an illegal state value of "enable" rather than "normal"
|
||||
* New Shortcuts for Elements
|
||||
* Sp = Spin
|
||||
* SBar = StatusBar
|
||||
* BM = ButtonMenu
|
||||
* Progress = ProgressBar
|
||||
* Im = Image
|
||||
* G = Graph
|
||||
* Fr = Frame
|
||||
* Sl = Slider
|
||||
* Button - Allow button color background to be specified as None. This will cause the theme's color to be auto chosen as background
|
||||
* Image.DrawArc - fill_color parameter added
|
||||
* Column - update now uses the expand information so that a column will re-pack correctly when made invisible to visible. Added fill parm to pack call
|
||||
* New Window parameters:
|
||||
* enable_close_attempted_event=False
|
||||
* titlebar_background_color=None
|
||||
* titlebar_text_color=None
|
||||
* titlebar_font=None
|
||||
* titlebar_icon=None
|
||||
* use_custom_titlebar=None
|
||||
* Removed "Faking Timeout" print because the state that triggered it can be reached using a normal auto-closing window
|
||||
* Can now intercept window close attempts when the user clicks X
|
||||
* If you don't want "X" to close the window, set enable_close_attempted_event to True when creating window
|
||||
* When enabled a WINDOW_CLOSE_ATTEMPTED_EVENT will be returned from read instead of WIN_CLOSED
|
||||
* Multiple aliases for the key: WINDOW_CLOSE_ATTEMPTED_EVENT, WIN_X_EVENT, WIN_CLOSE_ATTEMPTED_EVENT
|
||||
* New Window property - key_dict
|
||||
* Returns the "All keys dictionary" which has keys and elements for all elements that have keys specified
|
||||
* pin helper function got 2 new parameters - expand_x=None, expand_y=None. Was needed for the Titlebar element
|
||||
* no_titlebar implementation changed on Linux. Not using "splash" and instead using "dock". Was needed to get the minimize/restore to work
|
||||
* New set_options parameters in support of custom Titlebar element
|
||||
* use_custom_titlebar=None
|
||||
* titlebar_background_color=None
|
||||
* titlebar_text_color=None
|
||||
* titlebar_font=None
|
||||
* titlebar_icon=None
|
||||
* get_globals removed - not required for normal PySimpleGUI. Was only used by patched packages which will need to fork PySimpleGUI for this feature.
|
||||
* popup - support for custom titlebar!
|
||||
* Changed from pathlib to os.path
|
||||
|
||||
## Upcoming
|
||||
|
||||
The future for PySimpleGUI looks bright!
|
||||
|
|
Loading…
Reference in New Issue