pyqt

“Blinking” buttons in PyQT5

我怕爱的太早我们不能终老 提交于 2020-12-15 10:20:56
问题 Here's the deal: I'm trying to make button A "blink" when button B is pushed, and the blinking should then stop when the user pushes button A. Furthermore, button A should then go back to its former state. After long reading through the documentation and other questions at SO, I have now following piece of code: Python 2.7 class Widget(QWidget): def __init__(self): super(Widget, self).__init__() self.resize(300,200) layout = QVBoxLayout(self) self.button_stop = QPushButton("Stop") layout

Qmessagebox background and text color

不羁的心 提交于 2020-12-15 05:53:06
问题 I have message response as you see on the above. I've managed to colour background to black: msg.setStyleSheet("background-color: rgb(0, 0, 0);") I've tried with same way for the text but it looks like this: msg.setStyleSheet("text-color: rgb(255, 255, 255);") My only purpose is texts are white and background is black... Here is my part of code: msg = QMessageBox() msg.setText("Message has been sended") msg.setWindowTitle("SENT") msg.setWindowIcon(QtGui.QIcon("black tic.png")) msg.setIcon

How to display a cv2 video inside a python GUI? [duplicate]

情到浓时终转凉″ 提交于 2020-12-15 05:31:45
问题 This question already has answers here : PyQt showing video stream from opencv (3 answers) Closed last year . I'm creating a GUI using Python/PyQt5 which should display a video along with other widgets in the same window. I've tried different approaches to this problem but stil can't seem to get it to work. Approach 1: Adding the video in a pixmap using OpenCV/cv2 only shows the first frame of the video. Approach 2: I have managed to get the video to play using cv2 however, it opens up in a

Window Icon Not Displaying when Frozen with cx_Freeze

会有一股神秘感。 提交于 2020-12-13 07:29:04
问题 I’m using Python 3.6, PyQt5, and cx_Freeze in a Windows environment. The portion of code I use to display the icon on the main window and children windows is: if getattr(sys, 'frozen', False): # If frozen with cx_Freeze homePath = os.path.dirname(sys.executable) else: # Otherwise, if running unfrozen (e.g., within Spyder) homePath = os.path.dirname(__file__) iconFileName = os.path.join(homePath, 'iconLarge.ico') setWindowIcon(QIcon(iconFileName)) The frozen program defaults to a Windows

Fatal Python Error when running pytest with QT

女生的网名这么多〃 提交于 2020-12-13 05:02:50
问题 I'm new to pytest and I'm having trouble trying to run one of my test files. I'm getting the following output: ================================================== test session starts ================================================== platform linux -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 -- /home/jarel/anaconda3/bin/python cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/jarel/workspace/spyder/rpgland/.hypothesis/examples')

PyQT5速成教程-4 Qt Designer实战[上]

元气小坏坏 提交于 2020-12-12 15:56:15
前言 在前面几节的学习中,我们对PyQt的基本使用、Qt Designer与Python编码的工作流程有了基本的学习。同时也掌握了Qt Designer中的布局方式和使用Python代码来实现布局。 让我们在下面的时间里,通过Qt Designer来设计一个计算整数的计算器吧。 使用网格布局(Grid Layout) 首先分析我们的整数计算器需要的一些按钮: 数字键:0-9共10个。 操作符:+ - * / = CE共6个 当我们在Qt Designer的主窗口中创建上述16个按钮之后,按照4行4列的顺序进行摆放。 摆放按钮 并且修改按钮的属性中的objectName为相对于的名称。如数字0的objectName设置为Num_0,操作符+的objectName设置为OP_plus。对于按钮的显示名称的修改,在主窗口中双击相应按钮则可以快速修改。 由于计算器中的按钮是正方形的(我们通常会选择正方形),而且不想让这些按钮根据窗口的大小进行变化,通过全选16个按钮(在主窗口中使用鼠标左键拖出选择框,选中16个按钮)在右侧找到mininumSize和maximumSize属性。点击其左面的箭头符号展开选项,将其宽和高固定为60。这样就不会因为缩放窗口而造成按钮的大小变化了。 属性 在对所有按钮完成相应操作之后,我们选中16个按钮,点击右键,使用网格布局来实现布局。

QCheckbox to check all other QCheckBoxes

为君一笑 提交于 2020-12-12 06:50:53
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

QCheckbox to check all other QCheckBoxes

狂风中的少年 提交于 2020-12-12 06:50:50
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

QCheckbox to check all other QCheckBoxes

拜拜、爱过 提交于 2020-12-12 06:50:29
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

Python/PySide: How can i destroy a terminated thread object?

情到浓时终转凉″ 提交于 2020-12-04 01:53:10
问题 I would like to implement a button to stop a thread with a process, it works but not as expected: i can't delete the thread object. ( EDIT: The reference to the thread object seems to be deleted, but the signals are not disconnected automatically by deleting the thread object, i can access it anyway via the signal.) I have a modul with a class thread_worker and a function for complex processing which is running as process: from PySide.QtCore import * from PySide.QtGui import * import