Publish showcase_scenes/ from marimo
Browse files- showcase_scenes/canvas.py +20 -0
- showcase_scenes/dialog.py +34 -0
- showcase_scenes/toolbar.py +32 -0
showcase_scenes/canvas.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pathlib
|
| 2 |
+
import tkinter as tk
|
| 3 |
+
|
| 4 |
+
MARKER = pathlib.Path(r"__MARKER__")
|
| 5 |
+
READY = pathlib.Path(str(MARKER) + ".ready")
|
| 6 |
+
|
| 7 |
+
root = tk.Tk()
|
| 8 |
+
root.title("Canvas")
|
| 9 |
+
root.geometry("560x360+200+150")
|
| 10 |
+
canvas = tk.Canvas(root, width=560, height=360, highlightthickness=0)
|
| 11 |
+
canvas.pack()
|
| 12 |
+
canvas.create_rectangle(0, 0, 560, 360, fill="#1e2430", outline="")
|
| 13 |
+
canvas.create_oval(40, 60, 160, 180, fill="#e05252", outline="")
|
| 14 |
+
canvas.create_rectangle(220, 60, 340, 180, fill="#4f9dd8", outline="")
|
| 15 |
+
canvas.create_polygon(400, 180, 460, 60, 520, 180, fill="#5fd08a", outline="")
|
| 16 |
+
canvas.create_rectangle(40, 240, 520, 300, fill="#c9a227", outline="")
|
| 17 |
+
|
| 18 |
+
root.update()
|
| 19 |
+
READY.write_text("mapped")
|
| 20 |
+
root.mainloop()
|
showcase_scenes/dialog.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pathlib
|
| 2 |
+
import tkinter as tk
|
| 3 |
+
|
| 4 |
+
MARKER = pathlib.Path(r"__MARKER__")
|
| 5 |
+
READY = pathlib.Path(str(MARKER) + ".ready")
|
| 6 |
+
|
| 7 |
+
root = tk.Tk()
|
| 8 |
+
root.title("Document")
|
| 9 |
+
root.geometry("420x230+120+120")
|
| 10 |
+
root.configure(bg="#f5f6f8")
|
| 11 |
+
|
| 12 |
+
title = tk.Label(root, text="Untitled document - unsaved changes", bg="#f5f6f8")
|
| 13 |
+
title.place(x=20, y=18)
|
| 14 |
+
tk.Label(root, text="File name", bg="#f5f6f8").place(x=20, y=70)
|
| 15 |
+
entry = tk.Entry(root)
|
| 16 |
+
entry.place(x=20, y=95, width=300, height=28)
|
| 17 |
+
entry.insert(0, "report.txt")
|
| 18 |
+
|
| 19 |
+
buttons = []
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def chosen():
|
| 23 |
+
MARKER.write_text("Save")
|
| 24 |
+
title.config(text="Saved to disk")
|
| 25 |
+
for widget in buttons:
|
| 26 |
+
widget.place_forget()
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
buttons.append(tk.Button(root, text="Save", command=chosen))
|
| 30 |
+
buttons[0].place(x=20, y=155, width=110, height=40)
|
| 31 |
+
|
| 32 |
+
root.update()
|
| 33 |
+
READY.write_text("mapped")
|
| 34 |
+
root.mainloop()
|
showcase_scenes/toolbar.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pathlib
|
| 2 |
+
import tkinter as tk
|
| 3 |
+
|
| 4 |
+
MARKER = pathlib.Path(r"__MARKER__")
|
| 5 |
+
READY = pathlib.Path(str(MARKER) + ".ready")
|
| 6 |
+
|
| 7 |
+
root = tk.Tk()
|
| 8 |
+
root.title("Desktop")
|
| 9 |
+
root.geometry("640x300+160+160")
|
| 10 |
+
root.configure(bg="#eef0f4")
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def note(what):
|
| 14 |
+
label.config(text="last action: " + what)
|
| 15 |
+
MARKER.write_text(what)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def bar(text, x):
|
| 19 |
+
button = tk.Button(root, text=text, command=lambda: note(text))
|
| 20 |
+
button.place(x=x, y=12, width=110, height=38)
|
| 21 |
+
return button
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
label = tk.Label(root, text="last action: (none)", bg="#eef0f4")
|
| 25 |
+
label.place(x=20, y=90)
|
| 26 |
+
for _text, _x in [("Files", 20), ("Terminal", 150), ("Save", 280), ("Cancel", 410)]:
|
| 27 |
+
bar(_text, _x)
|
| 28 |
+
tk.Label(root, text="Choose an action", bg="#eef0f4").place(x=20, y=150)
|
| 29 |
+
|
| 30 |
+
root.update()
|
| 31 |
+
READY.write_text("mapped")
|
| 32 |
+
root.mainloop()
|