check for non valid object
-
say i have such code:
... self.mw = QMainWindow() self.create_dock_widgets() ... def create_dock_widgets(self): # should i check if window is valid object? self.mw.addDockWidget...should i actually do it?
-
say i have such code:
... self.mw = QMainWindow() self.create_dock_widgets() ... def create_dock_widgets(self): # should i check if window is valid object? self.mw.addDockWidget...should i actually do it?
@user4592357
And do what if it isn't? You're only going toraise, andself.mw.addDockWidgetwillraiseanyway if it isn't. Plusself.mw = QMainWindow()would haveraised in the first place if it couldn't create a main window.Of course you can check everywhere if you wish. But that can be a lot of code. I wouldn't bother here.
P.S.
Unless you're doing it for a school project. In which case, goodness knows...