-
Have you checked closed issues? https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed Please give a brief but clear explanation of the issue. If you can, include a complete working example that demonstrates the bug. Check it can run without modifications. diff --git a/docs/examples/tutorial/stopwatch04.py b/docs/examples/tutorial/stopwatch04.py -class Stopwatch(Static):
@@ -25,7 +25,7 @@ class Stopwatch(Static): -class StopwatchApp(App):
@@ -35,7 +35,7 @@ class StopwatchApp(App):
if name == "main":
It will be helpful if you run the following command and paste the results:
Textual DiagnosticsVersions
Python
Operating System
Terminal
Rich Console options
Feel free to add screenshots and / or videos. These can be very helpful! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is what we'd expect to happen. You're matching on a type and types in Python are case-sensitive. Consider this example: from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Header, Footer, Label
class ThisIsATest( Label ):
pass
class ThisisaTest( Label ):
pass
class Thisisatest( Label ):
pass
class CSSCaseExampleApp( App[ None ] ):
CSS = """
ThisIsATest {
border: round red;
}
ThisisaTest {
border: round green;
}
Thisisatest {
border: round blue;
}
"""
def compose( self ) -> ComposeResult:
yield Header()
with Vertical():
yield ThisIsATest( "This is one class" )
yield ThisisaTest( "This is another class" )
yield Thisisatest( "And this is another still" )
yield Footer()
if __name__ == "__main__":
CSSCaseExampleApp().run() |
Beta Was this translation helpful? Give feedback.
-
Ok, so the issue is that the CSS specified Stopwatch -- thanks - my bad. I'm closing this issue - Thank you for your patience. |
Beta Was this translation helpful? Give feedback.
This is what we'd expect to happen. You're matching on a type and types in Python are case-sensitive.
StopWatch
andStopwatch
are two different Python classes.Consider this example: