Skip to content
Open
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: mixed-line-ending
args: ["-f", "lf"]
Expand All @@ -11,12 +11,12 @@ repos:
- id: double-quote-string-fixer
files: ^(FreeSimpleGUI(?:Qt|Web|Wx)?)/(?!Demo).*\.py
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.14.0
rev: v3.16.0
hooks:
- id: reorder-python-imports
files: ^(FreeSimpleGUI(?:Qt|Web|Wx)?)/(?!Demo).*\.py
- repo: https://github.com/psf/black
rev: '25.1.0'
- repo: https://github.com/psf/black-pre-commit-mirror
rev: '26.1.0'
hooks:
- id: black
args:
Expand All @@ -26,7 +26,7 @@ repos:
files: ^(FreeSimpleGUI(?:Qt|Web|Wx)?)/(?!Demo).*\.py

- repo: https://github.com/pycqa/flake8
rev: '7.1.2' # pick a git hash / tag to point to
rev: '7.3.0' # pick a git hash / tag to point to
hooks:
- id: flake8
args:
Expand Down
13 changes: 3 additions & 10 deletions FreeSimpleGUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from typing import List # noqa
from typing import Tuple # noqa


# get the tkinter detailed version
tclversion_detailed = tkinter.Tcl().eval('info patchlevel')
framework_version = tclversion_detailed
Expand Down Expand Up @@ -14538,9 +14537,7 @@ def _github_issue_post_make_markdown(
#### Project details

{}
""".format(
issue_type, operating_system, os_ver, psg_port, python_ver, psg_ver, gui_ver, project_details
)
""".format(issue_type, operating_system, os_ver, psg_port, python_ver, psg_ver, gui_ver, project_details)

body2 = """

Expand Down Expand Up @@ -14610,17 +14607,13 @@ def _github_issue_post_make_markdown(
body2 += """
## Watcha Makin?
{}
""".format(
str(project_details)
)
""".format(str(project_details))

if where_found:
body2 += """
## How did you find PySimpleGUI?
{}
""".format(
str(where_found)
)
""".format(str(where_found))
return body + body2


Expand Down
2 changes: 1 addition & 1 deletion FreeSimpleGUI/elements/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def _GetElementAtLocation(self, location):
:rtype: (Element)
"""

(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down
2 changes: 1 addition & 1 deletion FreeSimpleGUI/elements/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _GetElementAtLocation(self, location):
:rtype: (Element)
"""

(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down
4 changes: 2 additions & 2 deletions FreeSimpleGUI/elements/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _GetElementAtLocation(self, location):
:rtype: (Element)
"""

(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -540,7 +540,7 @@ def _GetElementAtLocation(self, location):
:rtype: (Element)
"""

(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down
1 change: 0 additions & 1 deletion FreeSimpleGUI/tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from FreeSimpleGUI.elements.image import Image
from FreeSimpleGUI.window import Window


_tray_icon_error = b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAADlAAAA5QGP5Zs8AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAIpQTFRF////20lt30Bg30pg4FJc409g4FBe4E9f4U9f4U9g4U9f4E9g31Bf4E9f4E9f4E9f4E9f4E9f4FFh4Vdm4lhn42Bv5GNx5W575nJ/6H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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIxGNZsAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAACVElEQVQ4T22S93PTMBhADQdl791SSsuRARTKKHsn+STZBptAi6zIacous+w9yyxl7z1T1h8ptHLhrrzLD5+/987R2XZElZ/39tZsbGg42NdvF4pqcGMs4XEcozAB/oQeu6wGr5fkAZcKOUIIRgQXR723wgaXt/NSgcwlO1r3oARkATfhbmNMMCnlMZdz5J8RN9fVhglS5JA/pJUOJiYXoShCkz/flheDvpzlBCBmya5KcDG1sMSB+r/VQtG+YoFXlwN0Us4yeBXujPmWCOqNlVwX5zHntLH5iQ420YiqX9pqTZFSCrBGBc+InBUDAsbwLRlMC40fGJT8YLRwfnhY3v6/AUtDc9m5z0tRJBOAvHUaFchdY6+zDzEghHv1tUnrNCaIOw84Q2WQmkeO/Xopj1xFBREFr8ZZjuRhA++PEB+t05ggwBucpbH8i/n5C1ZU0EEEmRZnSMxoIYcarKigA0Cb1zpHAyZnGj21xqICAA9dcvo4UgEdZ41FBZSTzEOn30f6QeE3Vhl0gLN+2RGDzZPMHLHKoAO3MFy+ix4sDxFlvMXfrdNgFezy7qrXPaaJg0u27j5nneKrCjJ4pf4e3m4DVMcjNNNKxWnpo6jtnfnkunExB4GbuGKk5FNanpB1nJCjCsThJPAAJ8lVdSF5sSrklM2ZqmYdiC40G7Dfnhp57ZsQz6c3hylEO6ZoZQJxqiVgbhoQK3T6AIgU4rbjxthAPF6NAwAOAcS+ixlp/WBFJRDi0fj2RtcjWRwif8Qdu/w3EKLcu3/YslnrZzwo24UQQvwFCrp/iM1NnHwAAAAASUVORK5CYII='
Expand Down
6 changes: 3 additions & 3 deletions FreeSimpleGUI/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def _GetElementAtLocation(self, location):
:rtype:
"""

(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -2760,7 +2760,7 @@ def timer_get_active_timers(self):
@classmethod
def _restore_stdout(cls):
for item in cls._rerouted_stdout_stack:
(window, element) = item # type: (Window, Element)
window, element = item # type: (Window, Element)
if not window.is_closed():
sys.stdout = element
break
Expand All @@ -2772,7 +2772,7 @@ def _restore_stdout(cls):
@classmethod
def _restore_stderr(cls):
for item in cls._rerouted_stderr_stack:
(window, element) = item # type: (Window, Element)
window, element = item # type: (Window, Element)
if not window.is_closed():
sys.stderr = element
break
Expand Down
20 changes: 9 additions & 11 deletions FreeSimpleGUIQt/FreeSimpleGUIQt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3320,7 +3320,7 @@ def Layout(self, rows):
self.AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -3485,7 +3485,7 @@ def Update(self, disabled=None, visible=None): # TODO Disable / enable of tabs
return self

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -3619,7 +3619,7 @@ def Layout(self, rows):
self.AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -3749,7 +3749,7 @@ def __init__(
temp_size = (150, 30) if self.Orientation.startswith('h') else (30, 150)
elif size[0] is not None and size[0] < 100:
temp_size = size[0] * 10, size[1] * 3
self.Widget = self.QT_Slider = None # type:QSlider
self.Widget = self.QT_Slider = None # type: QSlider

super().__init__(
ELEM_TYPE_INPUT_SLIDER,
Expand Down Expand Up @@ -4039,7 +4039,7 @@ def Layout(self, rows):
self.AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -5196,7 +5196,7 @@ def SetIcon(self, icon=None, pngbase64=None):
pass

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -6015,14 +6015,12 @@ def create_style_from_font(font):
is_bold_text = 'font-weight : bold;' if is_bold else ''
is_underline_text = 'text-decoration: underline;' if is_underline else ''

return textwrap.dedent(
f'''
return textwrap.dedent(f'''
{is_underline_text}
{is_bold_text}
font-family: "{font_name}";
font-size: {font_size}pt;
'''.strip()
).replace('\n', '')
'''.strip()).replace('\n', '')


def set_widget_visiblity(widget, visible):
Expand Down Expand Up @@ -8757,7 +8755,7 @@ def PackFormIntoFrame(container_elem, containing_frame, toplevel_win):
container_elem.QT_QTabWidget.addTab(tab_widget, element.Title)
# ------------------------- TabGroup placement element ------------------------- #
elif element_type == ELEM_TYPE_TAB_GROUP:
element = element # type:TabGroup
element = element # type: TabGroup
element.Widget = element.QT_QTabWidget = qtab = QTabWidget()

# === style ===
Expand Down
34 changes: 13 additions & 21 deletions FreeSimpleGUIWeb/FreeSimpleGUIWeb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import time
import pkg_resources


# from typing import List, Any, Union, Tuple, Dict # For doing types in comments. perhaps not required


Expand Down Expand Up @@ -524,28 +523,24 @@ def Get(self):

class TextInput_raw_onkeyup(remi.gui.TextInput):
@remi.gui.decorate_set_on_listener('(self, emitter, key, keycode, ctrl, shift, alt)')
@remi.gui.decorate_event_js(
"""var params={};params['key']=event.key;
@remi.gui.decorate_event_js("""var params={};params['key']=event.key;
params['keycode']=(event.which||event.keyCode);
params['ctrl']=event.ctrlKey;
params['shift']=event.shiftKey;
params['alt']=event.altKey;
sendCallbackParam('%(emitter_identifier)s','%(event_name)s',params);
event.stopPropagation();event.preventDefault();return false;"""
)
event.stopPropagation();event.preventDefault();return false;""")
def onkeyup(self, key, keycode, ctrl, shift, alt):
return (key, keycode, ctrl, shift, alt)

@remi.gui.decorate_set_on_listener('(self, emitter, key, keycode, ctrl, shift, alt)')
@remi.gui.decorate_event_js(
"""var params={};params['key']=event.key;
@remi.gui.decorate_event_js("""var params={};params['key']=event.key;
params['keycode']=(event.which||event.keyCode);
params['ctrl']=event.ctrlKey;
params['shift']=event.shiftKey;
params['alt']=event.altKey;
sendCallbackParam('%(emitter_identifier)s','%(event_name)s',params);
event.stopPropagation();event.preventDefault();return false;"""
)
event.stopPropagation();event.preventDefault();return false;""")
def onkeydown(self, key, keycode, ctrl, shift, alt):
return (key, keycode, ctrl, shift, alt)

Expand Down Expand Up @@ -1992,8 +1987,7 @@ def refresh(self):
i = int(time.time() * 1e6)
# self.app_instance.execute_javascript("""
if Window.App is not None:
Window.App.execute_javascript(
"""
Window.App.execute_javascript("""
var url = '/%(id)s/get_image_data?update_index=%(frame_index)s';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
Expand All @@ -2004,9 +1998,7 @@ def refresh(self):
document.getElementById('%(id)s').src = imageUrl;
}
xhr.send();
"""
% {'id': id(self), 'frame_index': i}
)
""" % {'id': id(self), 'frame_index': i})

def get_image_data(self, update_index):
headers = {'Content-type': self.mimetype if self.mimetype else 'application/octet-stream'}
Expand Down Expand Up @@ -2497,7 +2489,7 @@ def Layout(self, rows):
self.AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -2618,7 +2610,7 @@ def _Layout(self, rows):
# return self

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -2712,7 +2704,7 @@ def _Layout(self, rows):
self._AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -2882,7 +2874,7 @@ def Layout(self, rows):
self.AddRow(*row)

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -3281,7 +3273,7 @@ class Window:
stdout_string_io = None
stdout_location = None
port_number = 6900
active_windows = [] # type: [Window]
active_windows = [] # type: [Window]
App = None # type: remi.App

def __init__(
Expand Down Expand Up @@ -3645,7 +3637,7 @@ def SetIcon(self, icon=None, pngbase64=None):
pass

def _GetElementAtLocation(self, location):
(row_num, col_num) = location
row_num, col_num = location
row = self.Rows[row_num]
element = row[col_num]
return element
Expand Down Expand Up @@ -5310,7 +5302,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form):
except:
value = None
elif element.Type == ELEM_TYPE_TABLE:
element = element # type:Table
element = element # type: Table
value = [
element.SelectedRow,
]
Expand Down
Loading