Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
✨ Code for testing links in tables
Browse files Browse the repository at this point in the history
Relevant for when testing the following:

  Textualize/textual#2073
  Textualize/textual#2167
  • Loading branch information
davep committed Mar 30, 2023
1 parent 1e963ad commit 6d3a80c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions table_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, DataTable

class DTLinksApp( App[ None ] ):

CSS = """
DataTable {
height: 1fr;
}
"""

def compose( self ) -> ComposeResult:
yield Header()
yield DataTable()
yield Footer()

def on_mount( self ) -> None:
dt = self.query_one( DataTable )
dt.focus()
dt.add_columns( "Title", "URL Markup", "No Markup" )
dt.add_rows( [ (
f"Relevant XKCD {n}",
f"[link]https://xkcd.com/{n}/[/]",
f"https://xkcd.com/{n}/"
) for n in range( 500 ) ] )

if __name__ == "__main__":
DTLinksApp().run()

0 comments on commit 6d3a80c

Please sign in to comment.