mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
readme
This commit is contained in:
@@ -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')")
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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})"
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user