I got a question on how to reference the appcontext while the window component are itself part of the appcontext attribute. Here is my code snippet setup so far.
#Main Window Component
class MainWindow(QMainWindow):
def __init__(self,ctx):
super().__init__() # inherit the parent class attributes
self.ctx =ctx
#Application Context Class
class AppContext(ApplicationContext):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.window = MainWindow()
# show the main window and
def run(self):
self.window.show()
return self.app.exec_()
#method to get the resource image
def getImg(self):
return self.get_resource('sample.png')
if __name__ == '__main__':
appctxt = AppContext()
appctxt.run()
sys.exit(appctxt.app.exec_())
I guess my question is how could i pass appcontext as a object reference into the MainWindow
compnent as reference when MainWindow
itself is initialised inside the appcontext?
Thanks for helping out on this dumb question.