Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't use deprecated names #10

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions FreeSimpleGUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4443,48 +4443,6 @@ def _change_ttk_theme(style, theme_name):
return True


# class Stylist:
# """
# A class to help get information about ttk styles
# """
# @staticmethod
# def get_elements(layout):
# """Return a list of elements contained in the style"""
# elements = []
# element = layout[0][0]
# elements.append(element)
# sublayout = layout[0][1]
#
# if 'children' in sublayout:
# child_elements = Stylist.get_elements(sublayout['children'])
# elements.extend(child_elements)
# return elements
#
# @staticmethod
# def get_options(ttkstyle, theme=None):
# style = ttk.Style()
# if theme is not None:
# style.theme_use(theme)
# layout = style.layout(ttkstyle)
# elements = Stylist.get_elements(layout)
# options = []
# for e in elements:
# _opts = style.element_options(e)
# if _opts:
# options.extend(list(_opts))
# return list(set(options))
#
# @staticmethod
# def create_style(base_style: str, theme=None, **kwargs):
# style = ttk.Style()
# if theme is not None:
# style.theme_use(theme)
# style_id = uuid4()
# ttkstyle = '{}.{}'.format(style_id, base_style)
# style.configure(ttkstyle, **kwargs)
# return ttkstyle


def _make_ttk_style_name(base_style, element, primary_style=False):
Window._counter_for_ttk_widgets += 1
style_name = str(Window._counter_for_ttk_widgets) + '___' + str(element.Key) + base_style
Expand Down Expand Up @@ -4624,22 +4582,6 @@ def _make_ttk_scrollbar(element, orientation, window):
style.configure(style_name, relief=scroll_relief)


# if __name__ == '__main__':
# root = tk.Tk()
#
# # find out what options are available for the theme and widget style
# options = Stylist.get_options('TFrame', 'default')
# print('The options for this style and theme are', options)
#
# # create a new style
# frame_style = Stylist.create_style('TFrame', 'alt', relief=tk.RAISED, borderwidth=1)
#
# # apply the new style
# ttk.Frame(style=frame_style, width=100, height=100).pack(padx=10, pady=10)
#
# root.mainloop()


# @_timeit
def PackFormIntoFrame(form, containing_frame, toplevel_form):
"""
Expand Down
10 changes: 5 additions & 5 deletions FreeSimpleGUI/elements/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from FreeSimpleGUI import _make_ttk_scrollbar
from FreeSimpleGUI import _random_error_emoji
from FreeSimpleGUI import ELEM_TYPE_COLUMN
from FreeSimpleGUI import PopupError
from FreeSimpleGUI import popup_error
from FreeSimpleGUI import VarHolder
from FreeSimpleGUI._utils import _error_popup_with_traceback
from FreeSimpleGUI.elements.base import Element
Expand Down Expand Up @@ -300,7 +300,7 @@ def add_row(self, *args):
# ------------------------- Add the elements to a row ------------------------- #
for i, element in enumerate(args): # Loop through list of elements and add them to the row
if type(element) is list:
PopupError(
popup_error(
'Error creating Column layout',
'Layout has a LIST instead of an ELEMENT',
'This sometimes means you have a badly placed ]',
Expand All @@ -312,7 +312,7 @@ def add_row(self, *args):
)
continue
elif callable(element) and not isinstance(element, Element):
PopupError(
popup_error(
'Error creating Column layout',
'Layout has a FUNCTION instead of an ELEMENT',
'This likely means you are missing () from your layout',
Expand All @@ -328,7 +328,7 @@ def add_row(self, *args):
'*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***',
UserWarning,
)
PopupError(
popup_error(
'Error creating Column layout',
'The layout specified has already been used',
'You MUST start witha "clean", unused layout every time you create a window',
Expand Down Expand Up @@ -364,7 +364,7 @@ def layout(self, rows):
try:
iter(row)
except TypeError:
PopupError(
popup_error(
'Error creating Column layout',
'Your row is not an iterable (e.g. a list)',
f'Instead of a list, the type found was {type(row)}',
Expand Down
8 changes: 4 additions & 4 deletions FreeSimpleGUI/elements/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from FreeSimpleGUI import _random_error_emoji
from FreeSimpleGUI import ELEM_TYPE_FRAME
from FreeSimpleGUI import Element
from FreeSimpleGUI import PopupError
from FreeSimpleGUI import popup_error
from FreeSimpleGUI._utils import _error_popup_with_traceback
from FreeSimpleGUI.window import Window

Expand Down Expand Up @@ -146,7 +146,7 @@ def add_row(self, *args):
# ------------------------- Add the elements to a row ------------------------- #
for i, element in enumerate(args): # Loop through list of elements and add them to the row
if type(element) is list:
PopupError(
popup_error(
'Error creating Frame layout',
'Layout has a LIST instead of an ELEMENT',
'This sometimes means you have a badly placed ]',
Expand All @@ -157,7 +157,7 @@ def add_row(self, *args):
)
continue
elif callable(element) and not isinstance(element, Element):
PopupError(
popup_error(
'Error creating Frame layout',
'Layout has a FUNCTION instead of an ELEMENT',
'This likely means you are missing () from your layout',
Expand Down Expand Up @@ -206,7 +206,7 @@ def layout(self, rows):
try:
iter(row)
except TypeError:
PopupError(
popup_error(
'Error creating Frame layout',
'Your row is not an iterable (e.g. a list)',
f'Instead of a list, the type found was {type(row)}',
Expand Down
12 changes: 6 additions & 6 deletions FreeSimpleGUI/elements/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from FreeSimpleGUI import Element
from FreeSimpleGUI import LOOK_AND_FEEL_TABLE
from FreeSimpleGUI import PackFormIntoFrame
from FreeSimpleGUI import popup_error
from FreeSimpleGUI import popup_error_with_traceback
from FreeSimpleGUI import PopupError
from FreeSimpleGUI import ToolTip
from FreeSimpleGUI._utils import _error_popup_with_traceback
from FreeSimpleGUI.window import Window
Expand Down Expand Up @@ -217,7 +217,7 @@ def layout(self, rows):
try:
iter(row)
except TypeError:
PopupError(
popup_error(
'Error creating Tab layout',
'Your row is not an iterable (e.g. a list)',
f'Instead of a list, the type found was {type(row)}',
Expand Down Expand Up @@ -453,7 +453,7 @@ def add_row(self, *args):
# ------------------------- Add the elements to a row ------------------------- #
for i, element in enumerate(args): # Loop through list of elements and add them to the row
if type(element) is list:
PopupError(
popup_error(
'Error creating Tab layout',
'Layout has a LIST instead of an ELEMENT',
'This sometimes means you have a badly placed ]',
Expand All @@ -465,7 +465,7 @@ def add_row(self, *args):
)
continue
elif callable(element) and not isinstance(element, Element):
PopupError(
popup_error(
'Error creating Tab layout',
'Layout has a FUNCTION instead of an ELEMENT',
'This likely means you are missing () from your layout',
Expand All @@ -481,7 +481,7 @@ def add_row(self, *args):
'*** YOU ARE ATTEMPTING TO REUSE AN ELEMENT IN YOUR LAYOUT! Once placed in a layout, an element cannot be used in another layout. ***',
UserWarning,
)
PopupError(
popup_error(
'Error creating Tab layout',
'The layout specified has already been used',
'You MUST start witha "clean", unused layout every time you create a window',
Expand Down Expand Up @@ -516,7 +516,7 @@ def layout(self, rows):
try:
iter(row)
except TypeError:
PopupError(
popup_error(
'Error creating Tab layout',
'Your row is not an iterable (e.g. a list)',
f'Instead of a list, the type found was {type(row)}',
Expand Down
4 changes: 2 additions & 2 deletions FreeSimpleGUI/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from FreeSimpleGUI import ELEM_TYPE_TREE
from FreeSimpleGUI import EMOJI_BASE64_KEY
from FreeSimpleGUI import EVENT_TIMER
from FreeSimpleGUI import FillFormWithValues
from FreeSimpleGUI import fill_form_with_values
from FreeSimpleGUI import GRAB_ANYWHERE_IGNORE_THESE_WIDGETS
from FreeSimpleGUI import InitializeResults
from FreeSimpleGUI import PackFormIntoFrame
Expand Down Expand Up @@ -1222,7 +1222,7 @@ def fill(self, values_dict):
:rtype: (Window)
"""

FillFormWithValues(self, values_dict)
fill_form_with_values(self, values_dict)
return self

def _find_closest_key(self, search_key):
Expand Down