Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pyqt5 running string and clock stackoverfloww

class Ui_Form(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(498, 299)
            self.verticalLayoutWidget = QtWidgets.QWidget(Form)
            self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 479, 281))
            self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
            self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
            self.verticalLayout.setContentsMargins(0, 0, 0, 0)
            self.verticalLayout.setObjectName("verticalLayout")
            self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget)
            font = QtGui.QFont()
            font.setPointSize(15)
            self.label_2.setFont(font)
            self.label_2.setText("")
            self.label_2.setAlignment(QtCore.Qt.AlignCenter)
            self.label_2.setObjectName("label_2")
            self.verticalLayout.addWidget(self.label_2)
            self.tableWidget = QtWidgets.QTableWidget(self.verticalLayoutWidget)
            self.tableWidget.setObjectName("tableWidget")
            self.tableWidget.setColumnCount(0)
            self.tableWidget.setRowCount(0)
            self.verticalLayout.addWidget(self.tableWidget)
            self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
            font = QtGui.QFont()
            font.setPointSize(15)
            self.label.setFont(font)
            self.label.setObjectName("label")
            self.verticalLayout.addWidget(self.label)

            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)

        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "Running string ... "))


    if __name__ == "__main__":
        import sys
        app = QtWidgets.QApplication(sys.argv)
        Form = QtWidgets.QWidget()
        ui = Ui_Form()
        ui.setupUi(Form)
        Form.show()
        sys.exit(app.exec_()) ```


main file:

    ``` from PyQt5 import QtWidgets
    from PyQt5.QtCore import QTimer, QTime
    import sys
    import untitled


    class Widget(QtWidgets.QWidget):
        def __init__(self):
            super(Widget, self).__init__()
            self.ui = untitled.Ui_Form()
            self.ui.setupUi(self)

            self.x = 477
            self.y = self.height() - 30
            self.ui.label.move(self.x, self.y)

            self.timer = QTimer(self)
            self.timer.timeout.connect(self.move_label_left)
            self.timer.start(100)

            self.timer2 = QTimer(self)
            self.timer2.timeout.connect(self.show_clock)
            self.timer2.start(1000)

        def move_label_left(self):
            if self.x == -477:
                self.x = 477
                self.x -= 2
                self.ui.label.move(self.x, self.height() - 30)
            else:
                self.x -= 2
                self.ui.label.move(self.x, self.height() - 30)

        def show_clock(self):
            time = QTime.currentTime()
            text = time.toString('hh:mm:ss')
            self.ui.label_2.setText(text)


    app = QtWidgets.QApplication(sys.argv)
    w = Widget()
    w.show()
    sys.exit(app.exec_()) ```
Comment

PREVIOUS NEXT
Code Example
Python :: list of bad words python 
Python :: rename all files in a folder and subfolder 
Python :: datetime.timedelta 
Python :: 0 in python 
Python :: pyPS4Controller usage 
Python :: django template many to many count 
Python :: como poner python 3 en la terminal mac 
Python :: find the index of nanmax 
Python :: increase tkinter window resolution 
Python :: python iterate through lists itertools 
Python :: python get all the items list 
Python :: quicksort python3 
Python :: hash tables in python 
Python :: how to read file again in python 
Python :: how to change pi hostname in python file 
Python :: reassign variable python 
Python :: flask extends two base.html 
Python :: concat dataset 
Python :: grouped bar chart with labels 
Python :: validate delete inline formset django 
Python :: dictionnaire 
Python :: online image to python text converter 
Python :: python zpl 
Python :: pip set mirror site 
Python :: how to look up players states in skyblock hypixel python 
Python :: Indices may also be negative numbers, to start counting from the right:Indices may also be negative numbers, to start counting from the right: 
Python :: using deque to make a list 
Python :: different accuracy score for knn 
Python :: the most effective search methods in python with example 
Python :: Extract columns of dataframe to make new dataframe 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =