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

Rendering issue when hiding a widget #5056

Closed
xavierog opened this issue Sep 25, 2024 · 2 comments · Fixed by #5063
Closed

Rendering issue when hiding a widget #5056

xavierog opened this issue Sep 25, 2024 · 2 comments · Fixed by #5063

Comments

@xavierog
Copy link
Contributor

This is a follow-up to #5024, which ended with this question:

Could the same thing happen when a widget becomes invisible?

Potentially. I may have to do something similar with hidden widgets.

Would it translate into a rendering issue by chance?

from textual.app import App
from textual.containers import VerticalScroll
from textual.widgets import Footer, ProgressBar, RichLog, Placeholder

class MRE(App):
	BINDINGS = [("z", "toggle('RichLog')", "Console"), ("x", "toggle('ProgressBar')", "Progress bar")]
	CSS = """
	Placeholder { height: 15; }
	RichLog { border-top: dashed blue; height: 6; }
	.hidden { display: none; }
	"""
	def compose(self):
		with VerticalScroll():
			for i in range(10):
				yield Placeholder()
		yield ProgressBar(classes='hidden')
		yield RichLog(classes='hidden')
		yield Footer()

	def on_ready(self) -> None:
		self.query_one('RichLog').write('\n'.join(f'line #{i}' for i in range(5)))

	def action_toggle(self, widget_type) -> None:
		self.query_one(widget_type).toggle_class('hidden')

if __name__ == '__main__':
	app = MRE()
	app.run()

issue-5024-is-back

Originally posted by @xavierog in #5024 (comment)

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

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

Successfully merging a pull request may close this issue.

1 participant