SigMF icon indicating copy to clipboard operation
SigMF copied to clipboard

Import * is not considered good practice

Open PySimpleGUI opened this issue 3 years ago • 4 comments

Using an import * for PySimpleGUI needlessly pollutes your namespace. I know a lot of tkinter examples out on the internet do it, but it's because they get copied around, not because it's a good idea.

Thanks for using PySimpleGUI!

image

PySimpleGUI avatar Dec 02 '21 21:12 PySimpleGUI

Thanks for the issue.

It seems our GUI application also has some other issues; when I run it:

jacob@jacob-ds1:/opt/sigmf/SigMF$ sigmf_gui 
/home/jacob/.local/lib/python3.8/site-packages/PySimpleGUI/PySimpleGUI.py:1443: UserWarning: You cannot Update element with key = Update until the window.read() is called or finalized=True when creating window
  warnings.warn('You cannot Update element with key = {} until the window.read() is called or finalized=True when creating window'.format(self.Key),
/home/jacob/.local/lib/python3.8/site-packages/PySimpleGUI/PySimpleGUI.py:1443: UserWarning: You cannot Update element with key = Load Archive until the window.read() is called or finalized=True when creating window
  warnings.warn('You cannot Update element with key = {} until the window.read() is called or finalized=True when creating window'.format(self.Key),
/home/jacob/.local/lib/python3.8/site-packages/PySimpleGUI/PySimpleGUI.py:1443: UserWarning: You cannot Update element with key = Save Archive until the window.read() is called or finalized=True when creating window
  warnings.warn('You cannot Update element with key = {} until the window.read() is called or finalized=True when creating window'.format(self.Key),

jacobagilbert avatar Dec 10 '21 22:12 jacobagilbert

The error pretty much tells you what's happening.

I'm not sure where the original code came from that you're using as examples, but it's VERY old design patterns that were replaced a long time ago. None of the Demo Programs, Cookbook, etc, use things like .Layout(layout). Calls that are not PEP8 compliant were replaced a long time back too like Window.Read versus Window.read.

Looks like I missed one that still has a call to .Layout... so not QUITE None....

image

The call reference portion of the documentation groups together these non-PEP8 calls and explains they aren't recommended now.

If you need support for things like the above warnings, by all means open an issue on the PySimpleGUI GitHub (HTTP://Issues.PySimpleGUI.org). You can also open an Issue using the GUI built into PySimpleGUI. Call sg.main() and you'll see a button to open an issue.

PySimpleGUI avatar Dec 11 '21 16:12 PySimpleGUI

Thanks for the extra detail. I'm not particularly familiar with the GUI we have but it will most likely get fixed (or overhauled) after we get our specification 1.0 release out.

jacobagilbert avatar Dec 11 '21 16:12 jacobagilbert

image

PySimpleGUI avatar Dec 11 '21 16:12 PySimpleGUI