Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThemeManager running before widgets are created #15

Closed
Bromson3105 opened this issue Nov 29, 2024 · 2 comments
Closed

ThemeManager running before widgets are created #15

Bromson3105 opened this issue Nov 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Bromson3105
Copy link

I tried adding the example presented in Simple Guide. I got only to the part where the plot is created (before adding the line), and if I run that I get the exception "Line Chart theme configure failed : 'CTkLineChart' object has no attribute '_CTkLineChart__y_axis_frame'".

Going through the code, I see that the ThemeManager is being called to run before the widgets are created.

If I simply move the block

"""
Initialize Theme manager
"""
ThemeManager.bind_widget(self)
if ThemeManager.running_state is not True:
    ThemeManager.run()

to after self.__create_widgets() I don't get the exception anymore.

I haven't dug deep enough to see if this has any other undesired effects.

To Reproduce
Steps to reproduce the behavior:

  1. Import ctkchart
  2. Execute:
chart = ctkchart.CTkLineChart(
    master=self.chart_frame,
    x_axis_values=("a", "b", "c", "d", "e", "f"),
    y_axis_values=(100, 900),
)

Additional context
I am not running this at the moment my app starts, this is trigger after I go through a few screens and open a TopLevel. I mention this in case the fact that the app is running for a bit (a couple of seconds) before I call CTkLineChart is meaningful in any way.

Note
The exception doesn't occur when I launch the app, it happens once it passes by the code block I showed in the "To Reproduce" section

@Thisal-D Thisal-D added the bug Something isn't working label Nov 29, 2024
@Thisal-D
Copy link
Owner

Thank you for taking the time to report this issue and for providing detailed feedback. I appreciate your effort in investigating the code and suggesting a potential fix. Feedback like yours helps improve the project significantly.

I fixed the issue using your ideas (calling the theme manager after creating the chart object). The updated version is now available; please update to the latest release and let me know if you encounter any further issues.

Thank you once again for contributing to the project and helping make it better

@Bromson3105
Copy link
Author

Just here to confirmed that the update fixed it for me as well. Thank you for the prompt fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants