def citycord():#按钮定义
root = Tk()
root.title("城市编码")
root.geometry('1000x600')
yscrollbar = Scrollbar(root)
text = Text(root, height=1000, width=600)
yscrollbar.pack(side=RIGHT, fill=Y)
text.pack()
yscrollbar.config(command=text.yview)
text.config(yscrollcommand=yscrollbar.set)
str = """ 可以在代码中替换城市选项(代码中查找Ctrl+F)\n"""
text.insert(END, str)
root.mainloop()
#按钮放置
core = tk.Button (mainwinow, text="城市编码", command=citycore, font=("楷体", 15), width=10, height=1,cursor="spider")
core.place (x=500, y=520)