Python3 Tkinter 实例教学 (十二)标签Label 同时使用图片和文字 设定位置关系 compound
本节介绍同时使用图片和文字是,如何设定他们的位置
Label 作为一个最常用的控件,能够展示一些文本或者图片或者文本和图片的组合使用
构造方法:
Label(父对象, image=图片, text=文字, compound=位置关系)
compound:可选 left right top bottom center
代码实例:
# -*- coding:utf8 -*-
from tkinter import *
root = Tk()
root.title("Label Demo")
img = PhotoImage(file