I’m very new to python and i have some stupid question, thank you for helping!
when I search online about wxpython questions, I see almost 100% of the people use class for wxpython. From the book i learnt, the author didn’t mention using class for wxpython, instead he gave us a few examples that didn’t use class.
I just want to know, when is it good to use class and when is it really not so necessary.
In wxPython, you should use classes whenever you want to extend the functionality of something wxPython provides to you.
A lot of wxPython apps at the very least define a class inheriting from
wx.Frameto serve as the main GUI. If you need to add special behavior to certain widgets (e.g. add a method towx.Button), you might also want to write a class for that. Lastly, some special features in wxPython (like tabbed GUIs or wizards) require you to write a class for each page.There’s a lot of cases where you need to write a class. You almost always need to at least write one class for your main frame. Other than that, it depends on what kind of problems you’re trying to solve.
I’m not sure what book you read, but if you haven’t already I’d recommend wxPython in Action, which is really the definitive guide to wxPython.