Archived
0
0

fix: 改进

This commit is contained in:
2025-12-11 12:36:00 +08:00
parent a8ae1bacf3
commit 05a885a9d2
5 changed files with 32 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
from textual.widgets import (
Label,
Button,
)
from textual.widget import Widget
@@ -9,4 +10,10 @@ class Finished(Widget):
super().__init__(*children, name=name, id=id, classes=classes, disabled=disabled, markup=markup)
def compose(self):
yield Label("本次记忆进程结束, 下次再会!", id="finished_msg")
yield Label("本次记忆进程结束", id="finished_msg")
yield Button("返回上一级", id="back-to-menu")
def on_button_pressed(self, event):
button_id = event.button.id
if button_id == 'back-to-menu':
self.app.pop_screen()

View File

@@ -158,4 +158,4 @@ class MCQPuzzle(BasePuzzleWidget):
if button_id not in self.hashtable:
self.hashtable[button_id] = option
new_button = Button(option, id=button_id)
self.mount(new_button)
self.mount(new_button)

View File

@@ -11,4 +11,7 @@ class Placeholder(Widget):
def compose(self):
yield Label("示例标签", id="testlabel")
yield Button("示例按钮", id="testbtn", classes="choice")
yield Button("示例按钮", id="testbtn", classes="choice")
def on_button_pressed(self, event):
pass

View File

@@ -1,3 +1,4 @@
from textual.reactive import reactive
from textual.widgets import (
Markdown,
Label,
@@ -84,4 +85,4 @@ class Recognition(BasePuzzleWidget):
def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.id == "ok":
self.post_message(self.RatingChanged(5))
self.post_message(self.RatingChanged(5))