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.app import App
|
||||||
from textual import events
|
from textual import events
|
||||||
from textual.view import View
|
from textual.view import View
|
||||||
from textual.widgets import Button, Placeholder, Static
|
from textual.widgets import Button, Static
|
||||||
from textual.layouts.grid import GridLayout
|
from textual.layouts.grid import GridLayout
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -47,14 +47,10 @@ class GridTest(App):
|
|||||||
for name in "AC,+/-,%,/,7,8,9,X,4,5,6,-,1,2,3,+,.,=".split(",")
|
for name in "AC,+/-,%,/,7,8,9,X,4,5,6,-,1,2,3,+,.,=".split(",")
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons["AC"].style = "#000000 on rgb(165,165,165)"
|
for name in ("AC", "+/-", "%"):
|
||||||
buttons["+/-"].style = "#000000 on rgb(165,165,165)"
|
buttons[name].style = "#000000 on rgb(165,165,165)"
|
||||||
buttons["%"].style = "#000000 on rgb(165,165,165)"
|
for name in "/X-+=":
|
||||||
buttons["/"].style = "#ffffff on rgb(255,159,7)"
|
buttons[name].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)"
|
|
||||||
|
|
||||||
zero_text = make_text("0")
|
zero_text = make_text("0")
|
||||||
layout.place(
|
layout.place(
|
||||||
|
|||||||
@@ -307,10 +307,9 @@ class GridLayout(Layout):
|
|||||||
except (KeyError, IndexError):
|
except (KeyError, IndexError):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
free_slots -= {
|
free_slots.difference_update(
|
||||||
(col, row)
|
product(range(col1, col2 + 1), range(row1, row2 + 1))
|
||||||
for col, row in product(range(col1, col2 + 1), range(row1, row2 + 1))
|
)
|
||||||
}
|
|
||||||
|
|
||||||
region = self._align(
|
region = self._align(
|
||||||
from_corners(x1, y1, x2, y2),
|
from_corners(x1, y1, x2, y2),
|
||||||
|
|||||||
Reference in New Issue
Block a user