Skip to content

Commit

Permalink
Include relevant parts into the source
Browse files Browse the repository at this point in the history
  • Loading branch information
laffra committed Nov 13, 2023
1 parent f139db8 commit 51ff0ba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
10 changes: 5 additions & 5 deletions examples/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ def get_averages():
"Australia": 21.65,
}

resize_options = ltk.to_js({
"handles": "e",
"alsoResize": ".country",
})


def create():
resize_options = ltk.to_js({
"handles": "e",
"alsoResize": ".country",
})

return (
ltk.Container(
ltk.create("<h1>HTML Table created in Python</h1>"),
Expand Down
25 changes: 11 additions & 14 deletions examples/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
import inspect
import ltk

def choose(event):
square = ltk.find(event.target)
if not square.text():
square.append(
ltk.Text("X" if ltk.find(".choice").length % 2 else "O")
.addClass("choice")
)


def enter(event):
ltk.find(".square").css("background", "white")
square = ltk.jQuery(event.target)
if not square.text():
square.css("background", "lightblue")
def create():
def choose(event):
if not ltk.find(event.target).text():
ltk.find(event.target).append(
ltk.Text("X" if ltk.find(".choice").length % 2 else "O")
.addClass("choice")
)

def enter(event):
ltk.find(".square").css("background", "white")
if not ltk.jQuery(event.target).text():
ltk.jQuery(event.target).css("background", "lightblue")

def create():
return (
ltk.Div(
ltk.H2("Tic Tac Toe Game"),
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def cleanup(src):
ltk.VBox(
ltk.H2("The source:"),
ltk.TextArea(cleanup(example.attr("src")))
.css("height", 400)
.css("height", 500)
.css("border-width", 0)
.css("font-family", "Courier")
)
Expand Down

0 comments on commit 51ff0ba

Please sign in to comment.