Skip to content

Commit 5226f44

Browse files
authored
Merge pull request #10 from spyoungtech/deprecated_names
don't use deprecated names
2 parents 2b37047 + c4e629f commit 5226f44

File tree

5 files changed

+17
-75
lines changed

5 files changed

+17
-75
lines changed

FreeSimpleGUI/__init__.py

-58
Original file line numberDiff line numberDiff line change
@@ -4443,48 +4443,6 @@ def _change_ttk_theme(style, theme_name):
44434443
return True
44444444

44454445

4446-
# class Stylist:
4447-
# """
4448-
# A class to help get information about ttk styles
4449-
# """
4450-
# @staticmethod
4451-
# def get_elements(layout):
4452-
# """Return a list of elements contained in the style"""
4453-
# elements = []
4454-
# element = layout[0][0]
4455-
# elements.append(element)
4456-
# sublayout = layout[0][1]
4457-
#
4458-
# if 'children' in sublayout:
4459-
# child_elements = Stylist.get_elements(sublayout['children'])
4460-
# elements.extend(child_elements)
4461-
# return elements
4462-
#
4463-
# @staticmethod
4464-
# def get_options(ttkstyle, theme=None):
4465-
# style = ttk.Style()
4466-
# if theme is not None:
4467-
# style.theme_use(theme)
4468-
# layout = style.layout(ttkstyle)
4469-
# elements = Stylist.get_elements(layout)
4470-
# options = []
4471-
# for e in elements:
4472-
# _opts = style.element_options(e)
4473-
# if _opts:
4474-
# options.extend(list(_opts))
4475-
# return list(set(options))
4476-
#
4477-
# @staticmethod
4478-
# def create_style(base_style: str, theme=None, **kwargs):
4479-
# style = ttk.Style()
4480-
# if theme is not None:
4481-
# style.theme_use(theme)
4482-
# style_id = uuid4()
4483-
# ttkstyle = '{}.{}'.format(style_id, base_style)
4484-
# style.configure(ttkstyle, **kwargs)
4485-
# return ttkstyle
4486-
4487-
44884446
def _make_ttk_style_name(base_style, element, primary_style=False):
44894447
Window._counter_for_ttk_widgets += 1
44904448
style_name = str(Window._counter_for_ttk_widgets) + '___' + str(element.Key) + base_style
@@ -4624,22 +4582,6 @@ def _make_ttk_scrollbar(element, orientation, window):
46244582
style.configure(style_name, relief=scroll_relief)
46254583

46264584

4627-
# if __name__ == '__main__':
4628-
# root = tk.Tk()
4629-
#
4630-
# # find out what options are available for the theme and widget style
4631-
# options = Stylist.get_options('TFrame', 'default')
4632-
# print('The options for this style and theme are', options)
4633-
#
4634-
# # create a new style
4635-
# frame_style = Stylist.create_style('TFrame', 'alt', relief=tk.RAISED, borderwidth=1)
4636-
#
4637-
# # apply the new style
4638-
# ttk.Frame(style=frame_style, width=100, height=100).pack(padx=10, pady=10)
4639-
#
4640-
# root.mainloop()
4641-
4642-
46434585
# @_timeit
46444586
def PackFormIntoFrame(form, containing_frame, toplevel_form):
46454587
"""

FreeSimpleGUI/elements/column.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from FreeSimpleGUI import _make_ttk_scrollbar
88
from FreeSimpleGUI import _random_error_emoji
99
from FreeSimpleGUI import ELEM_TYPE_COLUMN
10-
from FreeSimpleGUI import PopupError
10+
from FreeSimpleGUI import popup_error
1111
from FreeSimpleGUI import VarHolder
1212
from FreeSimpleGUI._utils import _error_popup_with_traceback
1313
from FreeSimpleGUI.elements.base import Element
@@ -300,7 +300,7 @@ def add_row(self, *args):
300300
# ------------------------- Add the elements to a row ------------------------- #
301301
for i, element in enumerate(args): # Loop through list of elements and add them to the row
302302
if type(element) is list:
303-
PopupError(
303+
popup_error(
304304
'Error creating Column layout',
305305
'Layout has a LIST instead of an ELEMENT',
306306
'This sometimes means you have a badly placed ]',
@@ -312,7 +312,7 @@ def add_row(self, *args):
312312
)
313313
continue
314314
elif callable(element) and not isinstance(element, Element):
315-
PopupError(
315+
popup_error(
316316
'Error creating Column layout',
317317
'Layout has a FUNCTION instead of an ELEMENT',
318318
'This likely means you are missing () from your layout',
@@ -328,7 +328,7 @@ def add_row(self, *args):
328328
'*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***',
329329
UserWarning,
330330
)
331-
PopupError(
331+
popup_error(
332332
'Error creating Column layout',
333333
'The layout specified has already been used',
334334
'You MUST start witha "clean", unused layout every time you create a window',
@@ -364,7 +364,7 @@ def layout(self, rows):
364364
try:
365365
iter(row)
366366
except TypeError:
367-
PopupError(
367+
popup_error(
368368
'Error creating Column layout',
369369
'Your row is not an iterable (e.g. a list)',
370370
f'Instead of a list, the type found was {type(row)}',

FreeSimpleGUI/elements/frame.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from FreeSimpleGUI import _random_error_emoji
88
from FreeSimpleGUI import ELEM_TYPE_FRAME
99
from FreeSimpleGUI import Element
10-
from FreeSimpleGUI import PopupError
10+
from FreeSimpleGUI import popup_error
1111
from FreeSimpleGUI._utils import _error_popup_with_traceback
1212
from FreeSimpleGUI.window import Window
1313

@@ -146,7 +146,7 @@ def add_row(self, *args):
146146
# ------------------------- Add the elements to a row ------------------------- #
147147
for i, element in enumerate(args): # Loop through list of elements and add them to the row
148148
if type(element) is list:
149-
PopupError(
149+
popup_error(
150150
'Error creating Frame layout',
151151
'Layout has a LIST instead of an ELEMENT',
152152
'This sometimes means you have a badly placed ]',
@@ -157,7 +157,7 @@ def add_row(self, *args):
157157
)
158158
continue
159159
elif callable(element) and not isinstance(element, Element):
160-
PopupError(
160+
popup_error(
161161
'Error creating Frame layout',
162162
'Layout has a FUNCTION instead of an ELEMENT',
163163
'This likely means you are missing () from your layout',
@@ -206,7 +206,7 @@ def layout(self, rows):
206206
try:
207207
iter(row)
208208
except TypeError:
209-
PopupError(
209+
popup_error(
210210
'Error creating Frame layout',
211211
'Your row is not an iterable (e.g. a list)',
212212
f'Instead of a list, the type found was {type(row)}',

FreeSimpleGUI/elements/tab.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from FreeSimpleGUI import Element
1414
from FreeSimpleGUI import LOOK_AND_FEEL_TABLE
1515
from FreeSimpleGUI import PackFormIntoFrame
16+
from FreeSimpleGUI import popup_error
1617
from FreeSimpleGUI import popup_error_with_traceback
17-
from FreeSimpleGUI import PopupError
1818
from FreeSimpleGUI import ToolTip
1919
from FreeSimpleGUI._utils import _error_popup_with_traceback
2020
from FreeSimpleGUI.window import Window
@@ -217,7 +217,7 @@ def layout(self, rows):
217217
try:
218218
iter(row)
219219
except TypeError:
220-
PopupError(
220+
popup_error(
221221
'Error creating Tab layout',
222222
'Your row is not an iterable (e.g. a list)',
223223
f'Instead of a list, the type found was {type(row)}',
@@ -453,7 +453,7 @@ def add_row(self, *args):
453453
# ------------------------- Add the elements to a row ------------------------- #
454454
for i, element in enumerate(args): # Loop through list of elements and add them to the row
455455
if type(element) is list:
456-
PopupError(
456+
popup_error(
457457
'Error creating Tab layout',
458458
'Layout has a LIST instead of an ELEMENT',
459459
'This sometimes means you have a badly placed ]',
@@ -465,7 +465,7 @@ def add_row(self, *args):
465465
)
466466
continue
467467
elif callable(element) and not isinstance(element, Element):
468-
PopupError(
468+
popup_error(
469469
'Error creating Tab layout',
470470
'Layout has a FUNCTION instead of an ELEMENT',
471471
'This likely means you are missing () from your layout',
@@ -481,7 +481,7 @@ def add_row(self, *args):
481481
'*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***',
482482
UserWarning,
483483
)
484-
PopupError(
484+
popup_error(
485485
'Error creating Tab layout',
486486
'The layout specified has already been used',
487487
'You MUST start witha "clean", unused layout every time you create a window',
@@ -516,7 +516,7 @@ def layout(self, rows):
516516
try:
517517
iter(row)
518518
except TypeError:
519-
PopupError(
519+
popup_error(
520520
'Error creating Tab layout',
521521
'Your row is not an iterable (e.g. a list)',
522522
f'Instead of a list, the type found was {type(row)}',

FreeSimpleGUI/window.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from FreeSimpleGUI import ELEM_TYPE_TREE
5454
from FreeSimpleGUI import EMOJI_BASE64_KEY
5555
from FreeSimpleGUI import EVENT_TIMER
56-
from FreeSimpleGUI import FillFormWithValues
56+
from FreeSimpleGUI import fill_form_with_values
5757
from FreeSimpleGUI import GRAB_ANYWHERE_IGNORE_THESE_WIDGETS
5858
from FreeSimpleGUI import InitializeResults
5959
from FreeSimpleGUI import PackFormIntoFrame
@@ -1222,7 +1222,7 @@ def fill(self, values_dict):
12221222
:rtype: (Window)
12231223
"""
12241224

1225-
FillFormWithValues(self, values_dict)
1225+
fill_form_with_values(self, values_dict)
12261226
return self
12271227

12281228
def _find_closest_key(self, search_key):

0 commit comments

Comments
 (0)