有关python ttk模块的问题

from tkinter import *
from tkinter.ttk import *
root=Tk()
root.title('This is a ttk demo')
style=Style()
style.configure('TButton',font=14,relief='falt',background='#00f5ff')
btn=ttk.Button(text='This is a button',style='TButton').pack(pady=20)
root.mainloop()


输出报错了
btn=ttk.Button(text='This is a button',style='TButton').pack(pady=20)
NameError: name 'ttk' is not defined

为啥ttk带不出来 求解

你把ttk直接import *导入了,所以应该不用带ttk直接用Button就能调出来
你直接

btn=Button(text='This is a button',style='TButton').pack(pady=20)

这样试试?
有帮助望采纳