Python 3 – Tkinter位图

Python 3 – Tkinter位图

这个属性用于显示位图。有以下类型的位图可用:-

  • “error”
  • “gray75”
  • “gray50”
  • “gray25”
  • “gray12”
  • “hourglass”
  • “info”
  • “questhead”
  • “question”
  • “warning”

示例

# !/usr/bin/python3
from tkinter import *
import tkinter

top = Tk()

B1 = Button(top, text = "error", relief = RAISED,\ bitmap = "error")
B2 = Button(t vcop, 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()

结果

执行以上代码时,会产生以下结果 −

Python 3 - Tkinter位图

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程