Tkinter 位图



此属性显示位图。以下是可用的位图类型:

  • "error"
  • "gray75"
  • "gray50"
  • "gray25"
  • "gray12"
  • "hourglass"
  • "info"
  • "questhead"
  • "question"
  • "warning"

示例

from tkinter import *
import tkinter

top = Tk()

B1 = Button(top, text ="error", relief=RAISED,\ bitmap="error")
B2 = Button(top, text ="hourglass", relief=RAISED,\ bitmap="hourglass")
B3 = Button(top, text ="info", relief=RAISED,\ bitmap="info")
B4 = Button(top, text ="question", relief=RAISED,\ bitmap="question")
B5 = Button(top, text ="warning", relief=RAISED,\ bitmap="warning")

B1.pack()
B2.pack()
B3.pack()
B4.pack()
B5.pack()
top.mainloop()

执行上述代码后,将产生以下结果:

Tkinter Bitmaps
python_gui_programming.htm
广告