在tkinter中突出显示文本时,有什么方法可以创建窗口?

问题描述

click to view picture

有什么方法可以创建这个,这是当维基百科中的链接突出显示时的图片

解决方法

通过运行以下功能,您可以看到弹出窗口看起来像Tkinter程序

LARGE_FONT= ("Verdana",12)
NORM_FONT = ("Helvetica",10)
SMALL_FONT = ("Helvetica",8)

def popupmsg(msg):
    popup = tk.Tk()
    popup.wm_title("!")
    label = ttk.Label(popup,text=msg,font=NORM_FONT)
    label.pack(side="top",fill="x",pady=10)
    B1 = ttk.Button(popup,text="Okay",command = popup.destroy)
    B1.pack()
    popup.mainloop()

以后您可以通过删除某些行来在程序中使用它。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...