Problem with 'app_context' attribute when using BeeWare with Toga #2489
Teste55
started this conversation in
Debugging help
Replies: 1 comment 1 reply
-
It's impossible to debug what is going on when we don't have the code that is generating the problem - but the error indicates that you haven't assigned a value "app_context" to your app instance. It's not a Toga-specific error - it's an error referring to Python the basic variable and property naming. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm developing an application using BeeWare with the Toga library to create the user interface. However, I am facing an issue with an 'app_context' attribute when trying to launch my application. When I run the application, I receive the following error:
"AttributeError: 'App' object has no attribute 'app_context'"
Here is the relevant code snippet where the error occurs:
"self.main_window = toga.MainWindow(title=self.formal_name)"
It appears that the code is trying to access an 'app_context' attribute, which is not present in the App class. I have reviewed my implementation and cannot find where this attribute is being set. I would like to understand why this error is occurring and how I can fix it.
I will leave the application error window attached below when I try to run it.
Full error text:
""
Traceback (most recent call last):
File "\app\IP_Report_main_.py", line 9, in
app = main()
^^^^^^
File "\app\IP_Report_main_.py", line 5, in main
app.startup()
File "\app\IP_Report\app.py", line 18, in startup
self.main_window = toga.MainWindow(title=self.formal_name)
^^^^^^^^^^^^^^^^
File "\app_packages\toga\app.py", line 643, in main_window
self._impl.set_main_window(window)
File "\app_packages\toga_winforms\app.py", line 311, in set_main_window
self.app_context.MainForm = window._impl.native
^^^^^^^^^^^^^^^^
AttributeError: 'App' object has no attribute 'app_context'
""
Beta Was this translation helpful? Give feedback.
All reactions