# -*-coding:utf-8 -*-
'''
Button显示文本与图像
compound:指定文本与图像位置关系
bitmap:指定位图
'''
from tkinter import *
root = Tk()
Button(root, text = 'bottom', compound = 'bottom', bitmap = 'error').pack()
Button(root, text = 'top', compound = 'top', bitmap = 'hourglass').pack()
Button(root, text = 'right', compound = 'right', bitmap = 'info').pack()
Button(root, text = 'left', command = 'left', bitmap = 'question').pack()
Button(root, text = 'center', compound = 'center', bitmap = )
root.mainloop()
本文展示如何在Python的Tkinter库中使用Button控件显示文本与图像,并通过compound属性设置其位置关系。示例代码演示了底部、顶部、右侧、左侧及居中的复合按钮样式。
472

被折叠的 条评论
为什么被折叠?



