mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
simplify example
This commit is contained in:
@@ -4,7 +4,7 @@ from rich.text import Text
|
||||
from textual.app import App
|
||||
from textual import events
|
||||
from textual.view import View
|
||||
from textual.widgets import Button, Placeholder, Static
|
||||
from textual.widgets import Button, Static
|
||||
from textual.layouts.grid import GridLayout
|
||||
|
||||
try:
|
||||
@@ -47,14 +47,10 @@ class GridTest(App):
|
||||
for name in "AC,+/-,%,/,7,8,9,X,4,5,6,-,1,2,3,+,.,=".split(",")
|
||||
}
|
||||
|
||||
buttons["AC"].style = "#000000 on rgb(165,165,165)"
|
||||
buttons["+/-"].style = "#000000 on rgb(165,165,165)"
|
||||
buttons["%"].style = "#000000 on rgb(165,165,165)"
|
||||
buttons["/"].style = "#ffffff on rgb(255,159,7)"
|
||||
buttons["X"].style = "#ffffff on rgb(255,159,7)"
|
||||
buttons["-"].style = "#ffffff on rgb(255,159,7)"
|
||||
buttons["+"].style = "#ffffff on rgb(255,159,7)"
|
||||
buttons["="].style = "#ffffff on rgb(255,159,7)"
|
||||
for name in ("AC", "+/-", "%"):
|
||||
buttons[name].style = "#000000 on rgb(165,165,165)"
|
||||
for name in "/X-+=":
|
||||
buttons[name].style = "#ffffff on rgb(255,159,7)"
|
||||
|
||||
zero_text = make_text("0")
|
||||
layout.place(
|
||||
|
||||
@@ -307,10 +307,9 @@ class GridLayout(Layout):
|
||||
except (KeyError, IndexError):
|
||||
continue
|
||||
|
||||
free_slots -= {
|
||||
(col, row)
|
||||
for col, row in product(range(col1, col2 + 1), range(row1, row2 + 1))
|
||||
}
|
||||
free_slots.difference_update(
|
||||
product(range(col1, col2 + 1), range(row1, row2 + 1))
|
||||
)
|
||||
|
||||
region = self._align(
|
||||
from_corners(x1, y1, x2, y2),
|
||||
|
||||
Reference in New Issue
Block a user