Skip to content

Commit 0e558ec

Browse files
committed
Fix get_widget_options returning unused keys
1 parent 33df68e commit 0e558ec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ttkwidgets/utilities.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ def get_widget_options(widget):
1919
:param widget: tkinter.Widget instance to get the config options from
2020
:return: dict of options that you can pass on to widget.config()
2121
"""
22-
return {key: widget.cget(key) for key in widget.keys()}
22+
options = {}
23+
for key in widget.keys():
24+
value = widget.cget(key)
25+
if value not in ("", None):
26+
options[key] = value
27+
return options
2328

2429

2530
def copy_widget(widget, new_parent, level=0):

0 commit comments

Comments
 (0)