我有一个 tkinter 文本小部件,我可以从 excel 复制文本(例如)并将其粘贴到我的文本小部件“tC”中,并保持 excel 中的字体定义,如粗体、斜体、颜色等。我只得到黑色和基本的文本。我不明白是只是显示还是字体没有过去。谢谢这是我创建文本标签的方法:windPop = tk.Toplevel()windPop.attributes('-topmost', 'true')windPop.wm_geometry("600x600")frm1 = tk.LabelFrame(windPop)frm1.pack(side=tk.TOP)labT = tk.Label(frm1, text="Titre", bg="white", height=1, width=10)labT.grid(row=0,column=1)tT = tk.Text(frm1, height=1, width=10, bg="white")tT.grid(row=0,column=2)frm3 = tk.LabelFrame(windPop)frm3.pack()labT = tk.Label(frm3, text="Genre", bg="white", height=1, width=10)labT.grid(row=0,column=1)sexMail = tk.StringVar(frm3)sexMail.set("neutre")tG = tk.OptionMenu(frm3, windows.genreMailVariable, *windows.genreMail)tG.grid(row=0,column=2)frm2 = tk.LabelFrame(windPop)frm2.pack()labC = tk.Label(frm2, text="Corps du mail", bg="white", width=20)labC.grid(row=0,column=1)tC = tk.Text(frm2, height=30, width=40, bg="white")tC.grid(row=0,column=2)bb = tk.Button(windPop, text='valider creation', width=20)bb.pack(pady=10, side=tk.BOTTOM)bb.configure(command=lambda w=windows, corp=tC, titre=tT, genre=sexMail, par=windPop :self.valid_creation(w, corp, titre, genre, par))
添加回答
举报
0/150
提交
取消