Uploaded qt-test.py for test with qt
This commit is contained in:
43
qt-test.py
Normal file
43
qt-test.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
import time
|
||||
import random
|
||||
from PySide6 import QtCore, QtWidgets, QtGui
|
||||
|
||||
count=50
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
|
||||
|
||||
self.button = QtWidgets.QPushButton("Click me!")
|
||||
self.text = QtWidgets.QLabel("Hello World",
|
||||
alignment=QtCore.Qt.AlignCenter)
|
||||
|
||||
self.layout = QtWidgets.QVBoxLayout(self)
|
||||
self.layout.addWidget(self.text)
|
||||
self.layout.addWidget(self.button)
|
||||
self.button.clicked.connect(self.magic)
|
||||
|
||||
self.progess = QtWidgets.QProgressBar(self)
|
||||
self.progess.resize(800,30)
|
||||
self.progess.setValue(0)
|
||||
|
||||
@QtCore.Slot()
|
||||
def magic(self):
|
||||
self.text.setText(random.choice(self.hello))
|
||||
if(self.progess.value() != 100):
|
||||
self.progess.setValue(self.progess.value()+1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
widget = MyWidget()
|
||||
|
||||
widget.resize(800, 600) #Setzt die Anfangsfenstergröße
|
||||
widget.setFixedSize(widget.size()) #Fixiert die vordefinierte Größe
|
||||
widget.show()
|
||||
|
||||
|
||||
sys.exit(app.exec())
|
||||
Reference in New Issue
Block a user