pyqt

How to make the background color the same as the form background?

二次信任 提交于 2021-01-01 04:18:03
问题 In PyQt5 I'm getting some unexpected behavior from QTabWidget, the background seems to be white instead of the default form color (roughly light gray). Here is an example: # QTabWidget2.py from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QTabWidget, \ QGraphicsView, QFrame, QGridLayout from PyQt5.QtGui import QPalette from PyQt5.Qt import Qt def main(): app = QApplication([]) mainForm = MainForm() mainForm.show() app.exec() # end main class

Python: pyinstaller打包exe(含file version信息)

只谈情不闲聊 提交于 2020-12-31 11:08:13
最近项目上一直都是用Spyder直接运行.py文件的方式来执行每日的自动化程序,每天都要手动去点击Run来执行一次,所以考虑把.py文件直接打包成exe,然后用windows的task schedule功能来让它自动每天运行。 用pyinstaller来打包exe文件,同时为了便于维护,给exe文件添加文件版本file version信息。 1. 安装pyinstaller 机器上的python环境是直接安装的Anaconda软件,所以直接打开“Anaconda Prompt”来安装pyinstaller,运行命令:pip install pyinstaller。(如果提示有其他相关的组件xxxx缺失,用相应的方式来安装就好: pip install xxxx) 2. 设置文件版本信息 为了方便版本管控,最好是给每次打包发布的exe文件设置文件版本信息——右键点击exe查看属性中的详情信息中可以看到版本信息。 方法一: 进入pyinstaller的此目录\PyInstaller\utils\cliutils\下(如果不知道路径可以通过去全盘查询cliutils来找到相应的文件夹,此处安利一款window上的文件查询小软件——Everything: https://www.voidtools.com/zh-cn/downloads/ ,查询速度超级快!) 你会看到如下几个文件:

How to change display size changing with window size in PyQT5?

此生再无相见时 提交于 2020-12-30 04:35:59
问题 I am displaying webcam image from cv2 on QPixmap. I have PyQt5 and Python2.7. Now the issue is the display size doesn't change with Window size. I like to change image size together with display window size. Now is always 640x480. Attached images show image size is fixed. I like to have just slightly smaller than window size and change together with window size. My code is as follow. from PyQt5 import QtCore, QtGui, QtWidgets import cv2 class Thread(QtCore.QThread): changePixmap = QtCore

How to change display size changing with window size in PyQT5?

蓝咒 提交于 2020-12-30 04:35:11
问题 I am displaying webcam image from cv2 on QPixmap. I have PyQt5 and Python2.7. Now the issue is the display size doesn't change with Window size. I like to change image size together with display window size. Now is always 640x480. Attached images show image size is fixed. I like to have just slightly smaller than window size and change together with window size. My code is as follow. from PyQt5 import QtCore, QtGui, QtWidgets import cv2 class Thread(QtCore.QThread): changePixmap = QtCore

Get all widgets under cursor

本秂侑毒 提交于 2020-12-29 13:18:53
问题 The widgetAt function gives me the widget directly under the cursor, at the highest z-order. pos = QtGui.QCursor.pos() widget = QtGui.qApp.widgetAt(pos) But how can I get all widgets under the cursor? Including those behind the top-most one? Something like: pos = QtGui.QCursor.pos() widgets = QtGui.qApp.widgetsAt(pos) Example As an example of use, picture an overlay which adds animated graphics, like ripples on the surface of water, wherever the user clicked. Naturally, the overlay would need

Get all widgets under cursor

我的未来我决定 提交于 2020-12-29 13:18:16
问题 The widgetAt function gives me the widget directly under the cursor, at the highest z-order. pos = QtGui.QCursor.pos() widget = QtGui.qApp.widgetAt(pos) But how can I get all widgets under the cursor? Including those behind the top-most one? Something like: pos = QtGui.QCursor.pos() widgets = QtGui.qApp.widgetsAt(pos) Example As an example of use, picture an overlay which adds animated graphics, like ripples on the surface of water, wherever the user clicked. Naturally, the overlay would need

Get all widgets under cursor

那年仲夏 提交于 2020-12-29 13:18:09
问题 The widgetAt function gives me the widget directly under the cursor, at the highest z-order. pos = QtGui.QCursor.pos() widget = QtGui.qApp.widgetAt(pos) But how can I get all widgets under the cursor? Including those behind the top-most one? Something like: pos = QtGui.QCursor.pos() widgets = QtGui.qApp.widgetsAt(pos) Example As an example of use, picture an overlay which adds animated graphics, like ripples on the surface of water, wherever the user clicked. Naturally, the overlay would need

Best way to extract .ico from .exe and paint with PyQt?

那年仲夏 提交于 2020-12-29 02:40:04
问题 I am looking for a way to extract an icon from a .exe file using Python. I know that you can use win32gui's ExtractIconEx function to grab the icon of a .exe but this returns a HIcon resource handle which is no good because I want to paint the icon using PyQt. Also the only example I have seen using win32gui does not have any transparency and the icons do not look smooth. What would be the best way to go about doing this using Python & PyQt? --Edit-- Thanks to help from Lukáš Lalinský this

Best way to extract .ico from .exe and paint with PyQt?

假装没事ソ 提交于 2020-12-29 02:39:23
问题 I am looking for a way to extract an icon from a .exe file using Python. I know that you can use win32gui's ExtractIconEx function to grab the icon of a .exe but this returns a HIcon resource handle which is no good because I want to paint the icon using PyQt. Also the only example I have seen using win32gui does not have any transparency and the icons do not look smooth. What would be the best way to go about doing this using Python & PyQt? --Edit-- Thanks to help from Lukáš Lalinský this

Best way to extract .ico from .exe and paint with PyQt?

老子叫甜甜 提交于 2020-12-29 02:38:32
问题 I am looking for a way to extract an icon from a .exe file using Python. I know that you can use win32gui's ExtractIconEx function to grab the icon of a .exe but this returns a HIcon resource handle which is no good because I want to paint the icon using PyQt. Also the only example I have seen using win32gui does not have any transparency and the icons do not look smooth. What would be the best way to go about doing this using Python & PyQt? --Edit-- Thanks to help from Lukáš Lalinský this