pyside

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

少造轮子!推荐一个Qt的Python组件库

血红的双手。 提交于 2020-12-18 06:32:20
虽然Qt提供了不少现成的组件,但是在Python中使用PyQt5或PySide2进行图形界面程序开发的过程,还是免不了要根据自己的需求组合一些小部件以形成新的自定义组件。 最近州的先生在写一个桌面图形界面的登录密码框的过程中,发现了这样一个小巧的自定义组件库。 其目前提供了密码输入框组件、渐变组件、均衡器组件、调色板组件。 下面我们一起来看看它的效果。 安装 直接使用 pip 工具进行安装即可,命令如下: pip install qtwidgets 密码输入框 在PyQt5和PySide2中,我们一般使用QLineEdit()小部件,通过设置它的 EchoMode 属性来让输入的文本显示星号而非明文,代码如下所示: # encoding:utf-8 from PySide2 import QtWidgets import sys class Widget ( QtWidgets . QWidget ): def __init__ ( self ): super (). __init__ () self . setWindowTitle ( "州的先生-zmister.com" ) self . pwd_input = QtWidgets . QLineEdit ( self ) self . pwd_input . setEchoMode ( QtWidgets .

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

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

人走茶凉 提交于 2020-12-04 01:48:35
问题 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

Mayavi入门之mlab.points3d

十年热恋 提交于 2020-10-31 06:27:03
1.安装 距离我之前的 Mayavi入门 的帖子差不多两年了,最近需要用到Mayavi来作图。因此重新安装一下(之前如果安装过想更新最新版本的话,最好卸载干净,不然会有各种想象不到的问题) 1. 安装python 2,安装PyQt5,事实上Mayavi官方说支持PyQt4,Pyside,Pyside2等UI框架 pip install PyQt5 3,安装Mayavi,最新的版本是4.7版本,pip如果下载速度慢,可以换豆瓣的源,方法见我之前的帖子。 pip install Mayavi 2.mlab.points3d 函数详解 mayavi.mlab. points3d ( *args , **kwargs ) 给定坐标绘制三维点图 points3d(x, y, z) points3d(x, y, z, s, ...) 一般用以上两个函数格式,其中x,y,z是点的坐标可以是numpy数组或者lists。如果只给定坐标,画出来的点大小,颜色都相同。s数组大小与坐标相同,s的数值可以影响点的颜色和大小。 下面给出关键字参数: 以官网的例子说明: 1 import numpy as np 2 from mayavi import mlab 3 4 def test_points3d(): 5 t = np.linspace(0, 4 * np.pi, 20 ) 6 x = np.sin