#!/usr/bin/env python3
# coding=utf-8
from tkinter import *
from tkinter import ttk
__author__ = 'Administrator'
root = Tk()
name = StringVar()
password = StringVar()
note = StringVar()
name_label = ttk.Label(root, text="姓名")
pwd_label = ttk.Label(root, text="密码")
name_entry = ttk.Entry(root, textvariable=name, width=10)
# print(name_entry.configure())
pwd_entry = ttk.Entry(root, textvariable=password, show="*", width=10)
note_entry = ttk.Entry(root, textvariable=note, state=["readonly"]) # invalid
note.set("只读文本框")
name_label.grid(row=1, column=1)
name_entry.grid(row=1, column=2, sticky=W)
pwd_label.grid(row=2, column=1)
pwd_entry.grid(row=2, column=2, sticky=W)
note_entry.grid(row=3, column=1, columnspan=2)
for child in root.winfo_children():
child.grid(padx=5, pady=5)
name.set("soeien")
name_entry.delete(0, 2)
name_entry.insert(0, "jack ")
root.mainloop()