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

Cannot import textual_plotext: DEFAULT_COLORS does not exist. #15

Open
PlasmaHH opened this issue Nov 27, 2024 · 2 comments
Open

Cannot import textual_plotext: DEFAULT_COLORS does not exist. #15

PlasmaHH opened this issue Nov 27, 2024 · 2 comments

Comments

@PlasmaHH
Copy link

Trying the examplem from the readme I get:

Traceback (most recent call last):
  File "/home/plasmahh/src/python/./pl.py", line 5, in <module>
    from textual_plotext import PlotextPlot
  File "/home/plasmahh/.venv/dev/lib64/python3.11/site-packages/textual_plotext/__init__.py", line 3, in <module>
    from .plot import Plot, themes
  File "/home/plasmahh/.venv/dev/lib64/python3.11/site-packages/textual_plotext/plot.py", line 21, in <module>
    from textual.app import DEFAULT_COLORS
ImportError: cannot import name 'DEFAULT_COLORS' from 'textual.app' (/home/plasmahh/.venv/dev/lib64/python3.11/site-packages/textual/app.py)

It looks like the internals of theming of textual changed...

Additionally when I re-create that DEFAULT_COLORS like it was in older versions I get some "ScatterApp object has no attribute dark" error, it seems also that the dark/light mode detection has changed.

@Zaloog
Copy link
Contributor

Zaloog commented Nov 27, 2024

Hi @PlasmaHH
yes right, with the new theme system in textual it broke some of textual-plotext internals.
Darren already created a PR for that.
Until that is merged and a new release is created, you could reference that branch for textual-plotext installation https://github.com/Textualize/textual-plotext/tree/update-for-theme-system to already have the fixes in place

@PlasmaHH
Copy link
Author

Alright. Until that is done I will keep my workaround which is like:

textual.app.DEFAULT_COLORS = {  "dark" : textual.design.ColorSystem(....) }
import textual_plotext

because I can't require people using my app to install things from git ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants