Tag:pyqt5

  • How to implement progress bar by pyqt5 in Python

    Time:2020-5-13

    This article mainly introduces how Python realizes the progress bar through pyqt5. The example code in this article is very detailed, which has certain reference learning value for everyone’s study or work. You can refer to the following for friends who need it Python is too broad and profound, and there are many scenarios. Recently, […]

  • Pyqt5 of Python changes the background color of label through buttons

    Time:2020-3-14

    Use setstylesheet method to modify the font, size and color you want Self.label = qlabel (“label font size color”, self) self.lab.setGeometry(50,50,300,200) self.setStyleSheet(“QLabel{color:rgb(225,22,173,255);font-size:50px;font-weight:normal;font-family:Arial;}”) Four parameters in color: rgb(), the first three of which control color and the fourth of which control transparency Font size: set font size Font weight: bold to set font bold Font family: […]

  • Pyqt5 implementation of toolbar text and image display at the same time

    Time:2020-3-9

    As follows: import sys from PyQt5.QtWidgets import QMainWindow, QTextEdit, QAction, QApplication from PyQt5.QtGui import QIcon from PyQt5.QtCore import Qt class Example(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): textEdit = QTextEdit() self.setCentralWidget(textEdit) exitAction = QAction(QIcon(‘images/exit.png’), ‘Exit’,self) exitAction.setShortcut(‘Ctrl+Q’) exitAction.setStatusTip(‘Exit application’) exitAction.triggered.connect(self.close) self.statusBar() menubar = self.menuBar() fileMenu = menubar.addMenu(‘&File’) fileMenu.addAction(exitAction) toolbar = self.addToolBar(‘Exit’) #Toolbar.settoolbuttonstyle (qt.toolbuttontextundericon) × text and […]

  • Pyqt5 combobox: how to get subscript, text and event selection function

    Time:2020-2-12

    As follows: Currenttext() get text Currentindex() gets the subscript Event selection function of self. ComboBox. Currentindexchanged. Connect() combobox The above pyqt5 combobox’s method of getting subscript, text and event selection function is the whole content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developepaer more.

  • An example of pyqt5 using label control to display time in real time

    Time:2020-2-10

    As follows: import sys from PyQt5 import QtGui, QtCore, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * class showTime(QDialog): def __init__(self): super(showTime, self).__init__() self.resize(500, 400) Self.setwindowtitle (“label display time”) self.label = QLabel(self) self.label.setFixedWidth(200) self.label.move(90, 80) self.label.setStyleSheet(“QLabel{background:white;}” “Qlabel {color: rgb (300300300120); font size: 10px; font weight: bold; font family: Tahoma;}” ) […]

  • Example of pyqt5 loading picture and text files

    Time:2020-2-9

    First let’s look at a set of effects After selecting picture text settings During selection Core code interpretation #This function is used to open the computer’s Explorer and select photos def loadFile(self): print(“load–file”) #QFileDialog is the type of system dialog. The first parameter is context, the second parameter is the name of the pop-up box, […]

  • The method of setting TextEdit auto scrolling in pyqt5

    Time:2020-2-1

    After the modified text, add: self.textEdit_6.moveCursor(QTextCursor.End) Example: self.textEdit_6.setPlainText(“Hello World”) The above method of setting TextEdit auto scrolling in pyqt5 is all the content shared by Xiaobian. I hope it can give you a reference and support developepaer.

  • How to use qscrollarea in pyqt5

    Time:2020-1-31

    As follows: import sys from PyQt5.QtWidgets import * class MainWindow(QMainWindow): def __init__(self,): super(QMainWindow,self).__init__() self.number = 0 w = QWidget() self.setCentralWidget(w) self.topFiller = QWidget() Self.topfiller.setminimumsize (250, 2000) set the size of the scroll bar for filename in range(20): self.MapButton = QPushButton(self.topFiller) self.MapButton.setText(str(filename)) self.MapButton.move(10,filename*40) ##Create a scroll bar self.scroll = QScrollArea() self.scroll.setWidget(self.topFiller) self.vbox = QVBoxLayout() self.vbox.addWidget(self.scroll) w.setLayout(self.vbox) […]

  • Instance of updating UI by sub thread of Python + pyqt5

    Time:2020-1-30

    The UI interface can’t be updated in the sub thread. It’s on the mobile side. Android’s UI access is unlocked. Multiple threads can access the same UI control for update operation at the same time. In other words, when accessing the UI, the controls in the Android system are not thread safe, which will lead […]

  • Detailed explanation of pyqt5 multithreading correct opening posture

    Time:2020-1-29

    As follows: # -*- coding: utf-8 -*- import sys from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QMessageBox, \ QPushButton, QLineEdit, QLabel, QToolTip, QComboBox, QTextEdit class MyBeautifulClass(QMainWindow): def __init__(self): super(MyBeautifulClass, self).__init__() self.init_ui() def init_ui(self): self.resize(1000, 800) self.setWindowTitle(‘Demo of PyQt5 QThread’) self.btn_1 = QPushButton(‘start’, self) self.btn_1.setGeometry(100, 100, 100, 50) self.btn_1.clicked.connect(self.slot_btn_1) self.linEdit_2 = QLineEdit(self) […]

  • How to display GIF picture in pyqt5

    Time:2020-1-27

    Using qmove method to realize Import library file from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QMovie Create a window with label control, label as the display form of gif class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(“Form”) Form.resize(517, 361) self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(0, 0, 500, 300)) self.label.setObjectName(“label”) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate […]

  • Pyqt5 method of drawing rectangle in the picture displayed in label

    Time:2020-1-26

    When using QT to write GUI program, we often need some interactive operations, such as mouse events, keyboard events and so on. What we want to achieve today is to draw a rectangular box in the image already displayed in the label, so as to carry out the next operation (such as zooming in the […]