Merge pull request #1918 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
PySimpleGUI 2019-09-03 20:17:15 -04:00 committed by GitHub
commit 7fd3686a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 439 additions and 500 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "4.4.0.7 Unreleased Scrollable Columns, ML, window()"
version = __version__ = "4.4.0.8 Unreleased Scrollable Columns, ML, window()"
# 888888ba .d88888b oo dP .88888. dP dP dP
@ -986,7 +986,7 @@ class Combo(Element):
InputCombo = Combo
DropDown = InputCombo
Drop = InputCombo
DD = Combo
# ---------------------------------------------------------------------- #
# Option Menu #
@ -1070,7 +1070,7 @@ class OptionMenu(Element):
# ------------------------- OPTION MENU Element lazy functions ------------------------- #
InputOptionMenu = OptionMenu
OM = OptionMenu
# ---------------------------------------------------------------------- #
# Listbox #
@ -1227,6 +1227,9 @@ class Listbox(Element):
update = Update
LBox = Listbox
# ---------------------------------------------------------------------- #
# Radio #
# ---------------------------------------------------------------------- #
@ -1318,6 +1321,10 @@ class Radio(Element):
set_tooltip = Element.SetTooltip
update = Update
R = Radio
Rad = Radio
# ---------------------------------------------------------------------- #
# Checkbox #
@ -1330,7 +1337,6 @@ class Checkbox(Element):
text_color=None, change_submits=False, enable_events=False, disabled=False, key=None, pad=None,
tooltip=None, visible=True):
"""
:param text: (str) Text to display next to checkbox
:param default: (bool). Set to True if you want this checkbox initially checked
:param size: Tuple[int, int] (width, height) width = characters-wide, height = rows-high
@ -1513,6 +1519,10 @@ class Spin(Element):
set_tooltip = Element.SetTooltip
update = Update
SpinBox = Spin
Spinner = Spin
# ---------------------------------------------------------------------- #
# Multiline #
# ---------------------------------------------------------------------- #
@ -1716,7 +1726,7 @@ class Text(Element):
# ------------------------- Text Element lazy functions ------------------------- #
Txt = Text # type: Text.__init__
Txt = Text # type: Text
T = Text # type: Text
@ -1796,6 +1806,9 @@ class StatusBar(Element):
set_tooltip = Element.SetTooltip
update = Update
Status = StatusBar
# ---------------------------------------------------------------------- #
# TKProgressBar #
# Emulate the TK ProgressBar using canvas and rectangles
@ -2021,6 +2034,8 @@ class Output(Element):
tk_out = TKOut
update = Update
Out = Output
# ---------------------------------------------------------------------- #
# Button Class #
# ---------------------------------------------------------------------- #
@ -2028,7 +2043,6 @@ class Button(Element):
"""
Button Element - Defines all possible buttons. The shortcuts such as Submit, FileBrowse, ... each create a Button
"""
def __init__(self, button_text='', button_type=BUTTON_TYPE_READ_FORM, target=(None, None), tooltip=None,
file_types=(("ALL Files", "*.*"),), initial_folder=None, disabled=False, change_submits=False,
enable_events=False, image_filename=None, image_data=None, image_size=(None, None),
@ -2454,6 +2468,7 @@ class ButtonMenu(Element):
set_tooltip = Element.SetTooltip
update = Update
BMenu = ButtonMenu
# ---------------------------------------------------------------------- #
@ -2532,6 +2547,10 @@ class ProgressBar(Element):
update = Update
update_bar = UpdateBar
PBar = ProgressBar
Prog = ProgressBar
# ---------------------------------------------------------------------- #
# Image #
@ -2695,7 +2714,7 @@ class Canvas(Element):
""" """
if self._TKCanvas is None:
print('*** Did you forget to call Finalize()? Your code should look something like: ***')
print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***')
print('*** window = sg.Window("My Form", layout, finalize=True) ***')
return self._TKCanvas
set_focus = Element.SetFocus
@ -3327,6 +3346,7 @@ class Frame(Element):
elif visible is True:
self.TKFrame.pack()
add_row = AddRow
layout = Layout
set_focus = Element.SetFocus
@ -4011,6 +4031,7 @@ class Column(Element):
set_tooltip = Element.SetTooltip
update = Update
Col = Column
# ---------------------------------------------------------------------- #
# Pane #
@ -6150,8 +6171,6 @@ class Window:
return self.Read(*args, **kwargs)
add_row = AddRow
add_rows = AddRows
alpha_channel = AlphaChannel

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "0.28.0.2 Unreleased PEP8-ifed"
version = __version__ = "0.28.0.3 Unreleased PEP8-ifed"
import sys
import types
@ -3720,6 +3720,17 @@ class Window:
print('The key you passed in is no good. Key = {}*'.format(key))
return None
def __call__(self, *args, **kwargs):
"""
Call window.Read but without having to type it out.
window() == window.Read()
window(timeout=50) == window.Read(timeout=50)
:param args:
:param kwargs:
:return: Tuple[Any, Dict[Any:Any]] The famous event, values that Read returns.
"""
return self.Read(*args, **kwargs)
add_row = AddRow
@ -3772,7 +3783,7 @@ def _element_callback_quit_mainloop(element):
# =========================================================================== #
# Stops the mainloop and sets the event information #
# Convert from characters to pixels #
# =========================================================================== #
def _convert_tkinter_size_to_Qt(size, scaling=DEFAULT_PIXELS_TO_CHARS_SCALING, height_cutoff=DEFAULT_PIXEL_TO_CHARS_CUTOFF):
"""

View File

@ -1,7 +1,6 @@
#usr/bin/python3
from clint import Args
version = __version__ = "0.31.0.3 Unreleased"
version = __version__ = "0.31.0.4 Unreleased"
import sys
import datetime
@ -1040,70 +1039,13 @@ class Text(Element):
self.Widget.set_text(str(value))
super().Update(self.Widget, background_color=background_color, text_color=text_color, font=font, visible=visible)
update = Update
# ------------------------- Text Element lazy functions ------------------------- #
Txt = Text
T = Text
# ---------------------------------------------------------------------- #
# TKProgressBar #
# Emulate the TK ProgressBar using canvas and rectangles
# ---------------------------------------------------------------------- #
class TKProgressBar():
def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], style=DEFAULT_PROGRESS_BAR_STYLE,
relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH,
orientation='horizontal', BarColor=(None, None), key=None):
self.Length = length
self.Width = width
self.Max = max
self.Orientation = orientation
self.Count = None
self.PriorCount = 0
if orientation[0].lower() == 'h':
s = ttk.Style()
s.theme_use(style)
if BarColor != COLOR_SYSTEM_DEFAULT:
s.configure(str(key) + "my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1],
troughrelief=relief, borderwidth=border_width, thickness=width)
else:
s.configure(str(key) + "my.Horizontal.TProgressbar", troughrelief=relief, borderwidth=border_width,
thickness=width)
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max,
style=str(key) + 'my.Horizontal.TProgressbar', length=length,
orient=tk.HORIZONTAL, mode='determinate')
else:
s = ttk.Style()
s.theme_use(style)
if BarColor != COLOR_SYSTEM_DEFAULT:
s.configure(str(length) + str(width) + "my.Vertical.TProgressbar", background=BarColor[0],
troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)
else:
s.configure(str(length) + str(width) + "my.Vertical.TProgressbar", troughrelief=relief,
borderwidth=border_width, thickness=width)
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max,
style=str(length) + str(width) + 'my.Vertical.TProgressbar',
length=length, orient=tk.VERTICAL, mode='determinate')
def Update(self, count=None, max=None):
if max is not None:
self.Max = max
try:
self.TKProgressBarForReal.config(maximum=max)
except:
return False
if count is not None and count > self.Max: return False
if count is not None:
try:
self.TKProgressBarForReal['value'] = count
except:
return False
return True
# ---------------------------------------------------------------------- #
# Output #
@ -3190,6 +3132,20 @@ class Window:
print('The key you passed in is no good. Key = {}*'.format(key))
return None
def __call__(self, *args, **kwargs):
"""
Call window.Read but without having to type it out.
window() == window.Read()
window(timeout=50) == window.Read(timeout=50)
:param args:
:param kwargs:
:return: Tuple[Any, Dict[Any:Any]] The famous event, values that Read returns.
"""
return self.Read(*args, **kwargs)
add_row = AddRow
add_rows = AddRows
alpha_channel = AlphaChannel

File diff suppressed because it is too large Load Diff