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

TreeNode is not "exported" from textual.widgets (or another public module) #5168

Closed
Hnasar opened this issue Oct 24, 2024 · 4 comments
Closed

Comments

@Hnasar
Copy link

Hnasar commented Oct 24, 2024

I want to have type checking but avoid importing textual.widgets._tree.TreeNode. Unfortunately textual.widgets.TreeNode isn't something that is importable or exported.

This seems like a duplicate of #992 but I'm not sure if there was a regression, or if the issue was never actually fixed.

Using 0.73.0

$ python -c 'from textual.widgets import TreeNode'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/venvs/versioned/algovenv11-1.0.95/lib/python3.10/site-packages/textual/widgets/__init__.py", line 103, in __getattr__
    raise ImportError(f"Package 'textual.widgets' has no class '{widget_class}'")
ImportError: Package 'textual.widgets' has no class 'TreeNode'


$ python -c 'from textual.widgets._tree import TreeNode'
Copy link

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

You are running on quite an old version of Textual. Although that probably has no bearing the import, which is as follows:

from textual.widgets.tree import TreeNode

@Hnasar
Copy link
Author

Hnasar commented Oct 24, 2024

Oh thank you! I missed this tree.py vs _tree.py when looking through.

@Hnasar Hnasar closed this as completed Oct 24, 2024
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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