Added Element.set_size method enabling the resizing of any element. Removed import * restriction
This commit is contained in:
parent
86805e9ebe
commit
338b16652d
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
version = __version__ = "4.5.0.16 Unreleased Mac Buttons experimental Justify fix"
|
version = __version__ = "4.5.0.17 Unreleased Mac Buttons. Element Resizing"
|
||||||
|
|
||||||
|
|
||||||
# 888888ba .d88888b oo dP .88888. dP dP dP
|
# 888888ba .d88888b oo dP .88888. dP dP dP
|
||||||
|
@ -755,6 +755,22 @@ class Element():
|
||||||
print('Was unable to set focus. The Widget passed in was perhaps not present in this element? Check your elements .Widget property')
|
print('Was unable to set focus. The Widget passed in was perhaps not present in this element? Check your elements .Widget property')
|
||||||
|
|
||||||
|
|
||||||
|
def set_size(self, size=(None, None)):
|
||||||
|
"""
|
||||||
|
Changes the size of an element to a specific size.
|
||||||
|
:param size: Tuple[int, int] The size in characters, rows typically
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if size[0] != None:
|
||||||
|
self.Widget.config(width=size[0])
|
||||||
|
except:
|
||||||
|
print('Warning, error setting width on element with key=', self.Key)
|
||||||
|
try:
|
||||||
|
if size[1] != None:
|
||||||
|
self.Widget.config(height=size[1])
|
||||||
|
except:
|
||||||
|
print('Warning, error setting height on element with key=', self.Key)
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Makes it possible to "call" an already existing element. When you do make the "call", it actually calls
|
Makes it possible to "call" an already existing element. When you do make the "call", it actually calls
|
||||||
|
@ -11517,7 +11533,7 @@ set_options = SetOptions
|
||||||
|
|
||||||
test = main
|
test = main
|
||||||
|
|
||||||
__all__ = ['** YOUR from PySimpleGUI import * HAS BEEN BLOCKED. YOU ARE NOT ALLOWED THIS KIND OF IMPORT WITH THIS LIBRARY **'] # do not allow import *
|
# __all__ = ['** YOUR from PySimpleGUI import * HAS BEEN BLOCKED. YOU ARE NOT ALLOWED THIS KIND OF IMPORT WITH THIS LIBRARY **'] # do not allow import *
|
||||||
|
|
||||||
# -------------------------------- ENTRY POINT IF RUN STANDALONE -------------------------------- #
|
# -------------------------------- ENTRY POINT IF RUN STANDALONE -------------------------------- #
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue