mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #958 from davep/toll-free
Review the use of the bell in various examples and documentation files
This commit is contained in:
@@ -5,7 +5,6 @@ from textual import events
|
||||
class ActionsApp(App):
|
||||
def action_set_background(self, color: str) -> None:
|
||||
self.screen.styles.background = color
|
||||
self.bell()
|
||||
|
||||
def on_key(self, event: events.Key) -> None:
|
||||
if event.key == "r":
|
||||
|
||||
@@ -5,7 +5,6 @@ from textual import events
|
||||
class ActionsApp(App):
|
||||
def action_set_background(self, color: str) -> None:
|
||||
self.screen.styles.background = color
|
||||
self.bell()
|
||||
|
||||
async def on_key(self, event: events.Key) -> None:
|
||||
if event.key == "r":
|
||||
|
||||
@@ -15,7 +15,6 @@ class ActionsApp(App):
|
||||
|
||||
def action_set_background(self, color: str) -> None:
|
||||
self.screen.styles.background = color
|
||||
self.bell()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -21,7 +21,6 @@ class ActionsApp(App):
|
||||
|
||||
def action_set_background(self, color: str) -> None:
|
||||
self.screen.styles.background = color
|
||||
self.bell()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -28,7 +28,6 @@ class ActionsApp(App):
|
||||
|
||||
def action_set_background(self, color: str) -> None:
|
||||
self.screen.styles.background = color
|
||||
self.bell()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -12,9 +12,6 @@ class InputApp(App):
|
||||
def on_key(self, event: events.Key) -> None:
|
||||
self.query_one(TextLog).write(event)
|
||||
|
||||
def key_space(self) -> None:
|
||||
self.bell()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = InputApp()
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
from textual.app import App
|
||||
|
||||
|
||||
class ExampleApp(App):
|
||||
pass
|
||||
|
||||
|
||||
app = ExampleApp()
|
||||
app.run()
|
||||
@@ -1,29 +0,0 @@
|
||||
from textual.app import App
|
||||
|
||||
|
||||
class ExampleApp(App):
|
||||
|
||||
COLORS = [
|
||||
"white",
|
||||
"maroon",
|
||||
"red",
|
||||
"purple",
|
||||
"fuchsia",
|
||||
"olive",
|
||||
"yellow",
|
||||
"navy",
|
||||
"teal",
|
||||
"aqua",
|
||||
]
|
||||
|
||||
def on_mount(self):
|
||||
self.styles.background = "darkblue"
|
||||
|
||||
def on_key(self, event):
|
||||
if event.key.isdigit():
|
||||
self.styles.background = self.COLORS[int(event.key)]
|
||||
self.bell()
|
||||
|
||||
|
||||
app = ExampleApp()
|
||||
app.run()
|
||||
@@ -27,7 +27,6 @@ class ButtonsApp(App[str]):
|
||||
)
|
||||
|
||||
def on_button_pressed(self, event: Button.Pressed) -> None:
|
||||
self.app.bell()
|
||||
self.exit(str(event.button))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user