mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
debugging app refreshes
This commit is contained in:
@@ -3,6 +3,10 @@ from textual.app import App
|
||||
|
||||
class ExampleApp(App):
|
||||
|
||||
CSS = """
|
||||
|
||||
"""
|
||||
|
||||
COLORS = [
|
||||
"white",
|
||||
"maroon",
|
||||
@@ -18,12 +22,15 @@ class ExampleApp(App):
|
||||
|
||||
def on_mount(self):
|
||||
self.styles.background = "darkblue"
|
||||
self.bind("t", "tree")
|
||||
|
||||
def on_key(self, event):
|
||||
if event.key.isdigit():
|
||||
self.styles.background = self.COLORS[int(event.key)]
|
||||
self.bell()
|
||||
|
||||
def action_tree(self):
|
||||
self.log(self.tree)
|
||||
|
||||
app = ExampleApp()
|
||||
app.run()
|
||||
|
||||
Reference in New Issue
Block a user