Saturday, June 27, 2026
First Shell Before Importing and Exporting
import customtkinter as ctk
import tkinter as tk
from tkinter import ttk
# ----------------------------
# Main Window
# ----------------------------
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
app = ctk.CTk()
app.title("Chess Study")
app.geometry("1200x700")
# ----------------------------
# Configure Grid
# ----------------------------
app.grid_rowconfigure(1, weight=1)
app.grid_columnconfigure(1, weight=1)
# ----------------------------
# Menu Bar
# ----------------------------
# ----------------------------
# Menu Bar
# ----------------------------
menu_bar = tk.Menu(app)
app.config(menu=menu_bar)
# ----------------------------
# File Menu
# ----------------------------
file_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="File",
menu=file_menu
)
file_menu.add_command(label="Import PGN")
file_menu.add_command(label="Export PGN")
file_menu.add_separator()
file_menu.add_command(
label="Exit",
command=app.quit
)
# ----------------------------
# Edit Menu
# ----------------------------
edit_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="Edit",
menu=edit_menu
)
# ----------------------------
# View Menu
# ----------------------------
view_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="View",
menu=view_menu
)
# ----------------------------
# Analysis Menu
# ----------------------------
analysis_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="Analysis",
menu=analysis_menu
)
# ----------------------------
# Tools Menu
# ----------------------------
tools_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="Tools",
menu=tools_menu
)
# ----------------------------
# Help Menu
# ----------------------------
help_menu = tk.Menu(menu_bar, tearoff=0)
menu_bar.add_cascade(
label="Help",
menu=help_menu
)
# ----------------------------
# Left Navigation
# ----------------------------
left_frame = ctk.CTkFrame(
app,
width=250
)
left_frame.grid(
row=1,
column=0,
sticky="ns"
)
left_frame.grid_propagate(False)
# ----------------------------
# Tree Style
# ----------------------------
style = ttk.Style()
style.theme_use("default")
style.configure(
"Treeview",
background="#111111",
fieldbackground="#111111",
foreground="#EEEEEE",
borderwidth=0,
rowheight=24
)
style.map(
"Treeview",
background=[("selected", "#1F6AA5")],
foreground=[("selected", "#FFFFFF")]
)
tree = ttk.Treeview(
left_frame,
style="Treeview",
show="tree"
)
tree.pack(
fill="both",
expand=True
)
# Root Items
collections = tree.insert(
"",
"end",
text="Collections",
open=True
)
analysis = tree.insert(
"",
"end",
text="Analysis",
open=True
)
music = tree.insert(
"",
"end",
text="Music Notes",
open=True
)
# Collections
worldcup = tree.insert(
collections,
"end",
text="World Cup"
)
olympiad = tree.insert(
collections,
"end",
text="Olympiad"
)
highschool = tree.insert(
collections,
"end",
text="High School"
)
# Example Children
tree.insert(
worldcup,
"end",
text="Round 1"
)
tree.insert(
worldcup,
"end",
text="Round 2"
)
tree.insert(
olympiad,
"end",
text="Open Section"
)
tree.insert(
olympiad,
"end",
text="Women's Section"
)
# ----------------------------
# Workspace
# ----------------------------
workspace = ctk.CTkFrame(app)
workspace.grid(
row=1,
column=1,
sticky="nsew",
padx=5,
pady=5
)
label = ctk.CTkLabel(
workspace,
text="Workspace",
font=("Arial", 24)
)
label.pack(
expand=True
)
# ----------------------------
# Status Bar
# ----------------------------
status = ctk.CTkLabel(
app,
text="Ready",
anchor="w",
height=24
)
status.grid(
row=2,
column=0,
columnspan=2,
sticky="ew"
)
app.mainloop()
Subscribe to:
Post Comments (Atom)
-
**See 6/22 post for adjustments.** Code can be tested at https://www.programiz.com/python-programming/online-compiler/ (Remove the 3 lines ...
-
The code below starts the bidding process. It's possible now to add graphics, that might be next as well as continuing with picking up. ...
No comments:
Post a Comment