返回顶部
扶摇直上九万里,展翅高飞岂可待。

python菜鸟学习: 14. GUI界面化使用

# 获取输入框中的内容
def getVars():
  global outterDomain1, innertDomian1, guestEid1, appName1, unicodeName1, rabbimqVip1
  print(outterDomain1, innertDomian1, guestEid1, appName1, unicodeName1, rabbimqVip1)

# 获取模板文件路径
def getFilepath1():
global filepath1
filepath1 = filedialog.askopenfilename()
text1.insert('insert', filepath1)
ProgressBar("", "开始选择模板文件")
ProgressBar(filepath1, "已选择")
return filepath1


# 获取模板文件路径
def getFilepath2():
global filepath2
filepath2 = filedialog.askopenfilename()
text2.insert('insert', filepath2)
ProgressBar("", "开始选择导入文件")
ProgressBar(filepath2, "已选择")
return filepath2


def creatWindow():
windows = tk.Tk()
windows.title("merge_setup_temple<---->模板更换")
windows.geometry("1024x768")
listName = ["outter_domain", "inner_domain", "eid", "appname", "rabbitmq_Vip", "uncodiceName|base64Name"]
for i in range(6):
Label1 = tk.Label(windows, text=listName[i], height=1, width=25)
Label1.grid(row=0, column=i, sticky="W")
global outterDomain, innertDomian, guestEid, appName, appName, unicodeName, rabbimqVip, text1, \
text2, text3, mysqlPass, mongodbPass, rabbitMqPass, redisPass

outter = tk.StringVar(value="www.yunzhijia.com")
outterDomain = tk.Entry(windows, show="", textvariable=outter, width=25)
outterDomain.grid(row=1, column=0, sticky="W")

inner = tk.StringVar(value="inner.yunzhijia.com")
innertDomian = tk.Entry(windows, show="", textvariable=inner, width=25)
innertDomian.grid(row=1, column=1, sticky="W")

eid = tk.StringVar(value="888888")
guestEid = tk.Entry(windows, show="", textvariable=eid, width=25)
guestEid.grid(row=1, column=2, sticky="W")

appname = tk.StringVar(value="云之家测试环境")
appName = tk.Entry(windows, show="", textvariable=appname, width=25)
appName.grid(row=1, column=3, sticky="W")

rabbimqvip = tk.StringVar(value="88.88.88.88")
rabbimqVip = tk.Entry(windows, show="", textvariable=rabbimqvip, width=25)
rabbimqVip.grid(row=1, column=4, sticky="W")

unicodeName = tk.Label(windows, text="根据appname自动生成", width=25)
unicodeName.grid(row=1, column=5, sticky="W")

listName1 = ["mysqlPass", "mongodbPass", "rabbitMqPass", "redisPass"]
for i in range(4):
Label2 = tk.Label(windows, text=listName1[i], height=1, width=25)
Label2.grid(row=2, column=i, sticky="W")

mysqlAuto = tk.StringVar(value="yzj!Mysql0909")
mysqlPass = tk.Entry(windows, show="", textvariable=mysqlAuto, width=25)
mysqlPass.grid(row=3, column=0, sticky="W")

mongodbAuto = tk.StringVar(value="yzj!Mongodb0909")
mongodbPass = tk.Entry(windows, show="", textvariable=mongodbAuto, width=25)
mongodbPass.grid(row=3, column=1, sticky="W")

RabbitMqAuto = tk.StringVar(value="yzj!Rabbit0909")
rabbitMqPass = tk.Entry(windows, show="", textvariable=RabbitMqAuto, width=25)
rabbitMqPass.grid(row=3, column=2, sticky="W")

redisAuto = tk.StringVar(value="yzj!Redis0909")
redisPass = tk.Entry(windows, show="", textvariable=redisAuto, width=25)
redisPass.grid(row=3, column=3, sticky="W")

tempFile = tk.Button(windows, text="选择模板文件", command=getFilepath1)
tempFile.grid(row=4, column=0, sticky="W")

text1 = tk.Text(windows, height=5, width=100)
text1.grid(row=5, columnspan=5, column=0)

oldFile = tk.Button(windows, text="选择导出文件", command=getFilepath2)
oldFile.grid(row=6, column=0, sticky="W")

text2 = tk.Text(windows, height=5, width=100)
text2.grid(row=7, columnspan=5, column=0)

button1 = tk.Button(windows, text="commit", command=getVars)
button1.grid(row=10, column=0, sticky="W")

text3 = tk.Text(windows, height=30, width=100)
text3.grid(row=11, columnspan=5, column=0)

windows.mainloop()


if __name__ == '__main__':
creatWindow()
posted @ 2022-09-09 10:33  鲤鱼洲畔  阅读(98)  评论(0编辑  收藏  举报