Skip to content

Commit db403c6

Browse files
committed
Style the examples
1 parent a3b70ce commit db403c6

File tree

4 files changed

+50
-14
lines changed

4 files changed

+50
-14
lines changed

examples/custom.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def create():
88

99
class CustomWidget(ltk.VBox):
10-
classes = [ "custom" ]
10+
classes = [ "custom Widget" ]
1111

1212
def __init__(self, src, label):
1313
ltk.VBox.__init__(self,
@@ -23,7 +23,8 @@ def __init__(self, src, label):
2323
ltk.Card(
2424
CustomWidget("https://chrislaffra.com/chris.png", "Chris laffra")
2525
).css("width", 200).draggable(),
26-
ltk.Text("For clarity, we marked the custom widget orange.").css("margin-top", 20),
26+
ltk.Text("For clarity, we marked the custom widget orange.")
27+
.css("margin-top", 20),
2728
ltk.H4("Tip: drag the card."),
2829
)
2930
.attr("name", "Custom") # example

index.html

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,34 @@
1515
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
1616
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
1717
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
18+
<style>
19+
#progress {
20+
position: absolute;
21+
overflow: hidden;
22+
top: 0px;
23+
z-index: 10000;
24+
width: 100%;
25+
height: 3px;
26+
}
27+
28+
#progress img {
29+
position: relative;
30+
height: 100px;
31+
width: 300%;
32+
top: -50px;
33+
left: -100vw;
34+
opacity: 0.5;
35+
}
36+
</style>
1837
</head>
1938
<body>
20-
<h1>The PyScript LTK Kitchen Sink</h1>
39+
<div id="progress">
40+
<img src="progress_line.gif">
41+
</div>
42+
43+
<center>
44+
<h1>The PyScript LTK Kitchen Sink</h1>
45+
</center>
2146

2247
<!-- Include LTK itself and its examples -->
2348
<py-config>

main.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,27 @@ def cleanup(src):
99
if not "# example" in line
1010
])
1111

12+
ltk.find("#progress").remove()
1213

1314
ltk.body.append(
14-
ltk.Tabs(
15-
ltk.HBox(
16-
example.css("width", "50%"),
17-
ltk.VBox(
18-
ltk.H2("The source:"),
19-
ltk.TextArea(cleanup(example.attr("src")))
20-
.css("height", 400)
21-
).css("width", "50%"),
22-
).attr("name", example.attr("name"))
23-
for example in examples.elements
15+
ltk.Div(
16+
ltk.Tabs(
17+
ltk.HBox(
18+
example.css("width", "40%"),
19+
ltk.VBox(
20+
ltk.H2("The source:"),
21+
ltk.TextArea(cleanup(example.attr("src")))
22+
.css("height", 400)
23+
.css("border-width", 0)
24+
.css("font-family", "Courier")
25+
)
26+
.css("width", "60%")
27+
.css("padding-left", 24)
28+
.css("border-left", "2px solid lightgray"),
29+
).attr("name", example.attr("name"))
30+
for example in examples.elements
31+
)
2432
)
25-
)
33+
.css("width", 1300)
34+
.css("margin", "auto")
35+
)

progress_line.gif

23.4 KB
Loading

0 commit comments

Comments
 (0)