小编Jay*_*oma的帖子

更新 PyQT 标签

我正在尝试使用计时器来计划更新网格中的某些值。下面是我尝试根据定时事件更新标签的示例。我已成功让它调用该函数,但无法更新标签。有什么想法吗?

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *

from PyQt5 import QtCore, QtGui, QtWidgets

class App(QWidget):

    def __init__(self):
        super().__init__() #these values change where the main window is placed
        self.title = 'This is my title'
        self.left = 400
        self.top = 400 
        self.width = 300
        self.height = 200
        self.initUI()


    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        # call the gridlayout function
        self.createGridLayout()
        self.time_label.text = 'change the value'
        windowLayout = QVBoxLayout()
        windowLayout.addWidget(self.horizontalGroupBox)
        self.setLayout(windowLayout)
        self.show() #this sets …
Run Code Online (Sandbox Code Playgroud)

python pyqt python-3.x pyqt5

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

pyqt ×1

pyqt5 ×1

python ×1

python-3.x ×1