[英]PyQt5 QLabel errors
在PyQT4中有一個QLabel()
當我在PyQT5中使用它時,會引發未定義的錯誤。
誰能告訴我PyQT4中的Qlabel是什么?
還是我錯了?
這是我的代碼:
import sys
import time
from PyQt5.QtCore import *
from PyQt5.QtGui import *
app = QGuiApplication(sys.argv)
try:
due = QTime.currentTime()
message = "Alert!"
if len(sys.argv) < 2 :
raise ValueError
hours, min = sys.argv[1].split(":")
due = Qtime(int(hours), int(min))
if not due.isValid():
raise ValueError
if len(sys.argv) > 2 :
message = " ".join(sys.argv[2:])
except ValueError :
message = "Alert: alert.pyw"
if QTime.currentTime() < due :
time.sleep(20) #20 Seconds
label = QLabel("<p>Message</p>")
您應該閱讀我發布的文檔 。 與其他添加此導入語句:
from PyQt5.QtWidgets import *
由於QLabel()位於PyQt5.QtWidgets中,請嘗試以下操作: 從PyQt5.QtWidgets導入QLabel
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.