Hi Phil,
Glad if I helped. A couple of final points that may help.
The use of -1 by wx & wxPython in some places as a parameter - the most common place to see this is for the Windows ID - each window needs a unique ID and in the Windows world that ID is an Unisigned Long type so Zero is a valid ID (definitely not one that you want to use). Duplicating IDs causes all sort of problems. You can manually set your windows IDs to values in the User range and try to keep track of them yourself but that often results in clashes accordingly wx & wxpython use an absolute value of -1 to say "Please assign the next unused number in the permitted range" to wx - this can also be spelt wx.ID_ANY which is preferable from a maintenance point of view but is 9 keys rather than 2 - hence a lot of examples use -1. If you look at the signature of wx.Frame you will see Frame(parent, id=ID_ANY, title=EmptyString, pos=DefaultPosition, size=DefaultSize, style=DEFAULT_FRAME_STYLE, name=FrameNameStr) but if you have imported wx and just type wx.ID_ANY you will see an output of -1.
The use of super - this is used to access and call parent class methods usually those with the same name as a method that your class defines - most commonly the __init__ method but it can be used for any method - python 3 simplified the syntax for super, but still allows the older syntax so you will often see super(parent_class, self).__init__(....) in older or backwards compatible code rather than the newer super().__init__(...).
One of the joys of both Python and wx is the degree of backwards compatibility that the developers have managed to maintain but sometimes it does lead to outdated code examples, online and in books, that can cause confusion. Note that whenever I have found old code that is "broken" by an update and fix the issue usually it turns out to be that I was getting away with doing something that I shouldn't have been and the fixed code still works with the older versions of python & wx (but possibly not the very old versions).
All the best for your wxpython journey.
Steve
> <
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fww
>
w.pylint.org%2F&data=04%7C01%7C%7C46ecf246d9bb4a69aa0708d905f3bcb0
> %7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637547366658419079%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uzb6A8LVwEcrEU4JT692sfx%2BCVST0YsCdG4gQhxCMVU%3D&reserved=0> and possibly black <
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fblack.readthedocs.io%2Fen%2Fstable%2F&data=04%7C01%7C%7C46ecf246d9bb4a69aa0708d905f3bcb0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637547366658419079%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=WqV2pJ6jX1PRg9taZvhXVW%2B%2Bd1SCNMA0tYKx4iiF9ZE%3D&reserved=0> these will help to keep your style consistent and valid but there are a number of other tools.
Thank you Steve and RF for your replies,
My question didn't really relate to formatting but more to the use of "super", default arguments and the use of -1 as an argument in the constructor. Your reply, Steve, has cleared up a couple of points that I found confusing. More reading is required.
I have used several different linters, formatters and IDEs over the years. I recently installed VS Code and like it a lot. I'm now using Pylint and Yapf.
--
Regards,
Phil
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wxpython-user...@googlegroups.com.
To view this discussion on the web visit
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fwxpython-users%2Fd207bacc-5e53-9add-57c9-3f0bedc40b5c%2540gmail.com&data=04%7C01%7C%7C46ecf246d9bb4a69aa0708d905f3bcb0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637547366658419079%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=qLTAT2IyYaqv2Ui9NELjHUsfA9iEEc9bROR5I7DhNqg%3D&reserved=0.