|
| 1 | +#!python -m tests.sample_window |
| 2 | +"""Sample window for testing.""" |
| 3 | + |
| 4 | + |
| 5 | +import logging |
| 6 | +import tkinter as tk |
| 7 | +from tkinter import ttk |
| 8 | + |
| 9 | +import awthemes |
| 10 | +from awthemes import AwthemesStyle |
| 11 | + |
| 12 | + |
| 13 | +logging.basicConfig(level=logging.DEBUG) |
| 14 | +log = logging.getLogger() |
| 15 | +log.setLevel(logging.DEBUG) |
| 16 | + |
| 17 | + |
| 18 | +log.debug("Path of Python-Awthemes: %r", awthemes.__file__) |
| 19 | + |
| 20 | + |
| 21 | +root = tk.Tk() |
| 22 | + |
| 23 | +# Get all avaliable themes. |
| 24 | +style = AwthemesStyle(root) |
| 25 | +print(style.theme_names()) |
| 26 | +style.theme_use("awbreezedark") |
| 27 | + |
| 28 | + |
| 29 | +root.title("TTK Sample Window") |
| 30 | +root.geometry("400x300") |
| 31 | + |
| 32 | +main_frame = ttk.Frame(root, padding="10") |
| 33 | +main_frame.pack(fill="both", expand=True) |
| 34 | + |
| 35 | +label = ttk.Label(main_frame, text="Welcome to TTK Sample Window!") |
| 36 | +label.pack(pady=10) |
| 37 | + |
| 38 | +entry = ttk.Entry(main_frame, width=30) |
| 39 | +entry.pack(pady=10) |
| 40 | + |
| 41 | +button = ttk.Button( |
| 42 | + main_frame, text="Click me.", |
| 43 | + command=lambda: label.config(text=f"The input is: {entry.get()}") |
| 44 | +) |
| 45 | +button.pack(pady=10) |
| 46 | + |
| 47 | +options = ["Option 1", "Option 2", "Option 3"] |
| 48 | +combo = ttk.Combobox(main_frame, values=options) |
| 49 | +combo.set("Make a choice...") |
| 50 | +combo.pack(pady=10) |
| 51 | + |
| 52 | +root.mainloop() |
0 commit comments