PyQt5最全6 QLabel控件的基本用法
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout
from PyQt5.QtGui import QPixmap, QPalette
from PyQt5.QtCore import Qt
class Label(QWidget):
"""
QLabel控件
setAlignment():设置文本的对齐方式
setIndent():设置文本缩进
text(): 获取文本内容
setBuddy():设置伙伴关系
setText():设置文本内容
selectedText():返回所选择的字符
setWordWrap():设置是否允许换行
QLabel常用的信号(事件)
1.当鼠标滑过QLabel控件时触发:linkHovered
2.当鼠标单击QLabel控件时触发:linkActivated
"""
def __init__(self):
super().__init__()
self.initUI()
def initUI(