This commit is contained in:
Will McGugan
2021-08-14 17:07:12 +01:00
parent 51d737b272
commit 611f089d9c
9 changed files with 51 additions and 52 deletions

View File

@@ -2,7 +2,7 @@ from textual.app import App
class Colorizer(App):
async def on_load(self, event):
async def on_load(self):
await self.bind("r", "color('red')")
await self.bind("g", "color('green')")
await self.bind("b", "color('blue')")

View File

@@ -1,9 +0,0 @@
from textual.app import App
class Quiter(App):
async def on_load(self, event):
await self.bind("q", "quit")
Quiter.run()

View File

@@ -2,7 +2,7 @@ from textual.app import App
class Beeper(App):
async def on_key(self, event):
def on_key(self):
self.console.bell()

View File

@@ -2,7 +2,7 @@ from textual.app import App
class ColorChanger(App):
async def on_key(self, event):
def on_key(self, event):
if event.key.isdigit():
self.background = f"on color({event.key})"

View File

@@ -1,4 +1,3 @@
from rich.console import RenderableType
from rich.panel import Panel
from textual.app import App
@@ -10,7 +9,7 @@ class Hover(Widget):
mouse_over = Reactive(False)
def render(self) -> RenderableType:
def render(self) -> Panel:
return Panel("Hello [b]World[/b]", style=("on red" if self.mouse_over else ""))
def on_enter(self) -> None: