# -*- coding: utf-8 -*- import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() root.title("tk25.py") root.geometry("300x250") ##################################### def replicate(): lb.config(text = "你輸入了 {}".format(tvar.get())) ttk.Style().configure('TEntry', foreground = 'blue') ttk.Style().configure('TLabel', foreground = 'brown') s = '123' tvar = tk.StringVar() ent = ttk.Entry(root, textvariable = tvar, font = "Harrington 14 bold", justify = tk.CENTER)#, show = '*') tvar.set(s) ent.pack() btn = ttk.Button(root, text = "Button", command = replicate) btn.pack() lb = ttk.Label(root, text = "Label", font = "Times 14 italic") lb.pack() ##################################### root.mainloop()