当前位置:网站首页>Some usage records about using pyqt5
Some usage records about using pyqt5
2022-06-25 15:09:00 【Solution_ Cen】
About use pyqt5 Some usage records
Environmental Science :Win10、Python3.7、Pyqt5 5.15
On the Internet pyqt5 There are not many detailed instructions for use , You can only try and error while using
Because it is an afterthought to record , I have to record some impressions I have encountered so far :
Detail related
1. The signal / Slot
To confirm and Pyqt5 The slot execution relationship between various form structures , Confirm the signal binding mode
The information found on the Internet says that signals can be activated through signals , Specific conditions have not been tested , At present, it is only clear that the following usage methods will make mistakes
Misuse :
In this case ,QtObjectB Of The signal B-1 Can't activate The signal A-1 Let's go QtObjectA Executive function A-1. Only by The signal B-1 Direct connection function A-1 For normal use ;
One of the ways that can be used successfully :
2.Run The process , perform QtThread, Application error ( No problem during debugging )
The estimate here is python The issue of execution ;
Details :
The use of PyCharm Development ,Debug There is no problem when , but Run Execute individual addition when QtThread The program will flash back , Background display error -1073740791 (0xC0000409), No other information .
because Debug There will be no problems when , Only in every sentence print Let's see what went wrong , Finally, it was found that there was an error when starting and running the child thread ;
I wrote a new simple class IOThread Inherit QtThread, Mainly to undertake some IO Mission , Here, I will create and execute in one statement , There is no named variable to accept :
def IOFunc(*arg, **karg):
#function
pass
Class IOThread(QtThread)
def __init__ (self, func, *arg, **karg):
self.func = func
self.arg = arg
self.karg = karg
def run(self)
self.func(*self.arg, **self.karg)
Class ObjectA(QtObject):
...
def FuncA(self):
...
IOThread(IOFunc, *Targ, **Tkarg).start() # This is written in PyCharm Run Will make mistakes , The written program will flash back
...
def FuncB(self):
...
temp = IOThread(IOFunc, *Targ, **Tkarg)
temp.start() # This is written in PyCharm Run Will make mistakes , The written program will flash back
...
def FuncC(self):
...
while True:
#IOThread(IOFunc).start() # This is written in PyCharm Run Will make mistakes , The written program will flash back
temp = IOThread(IOFunc, *Targ, **Tkarg)
temp.start() # This is written in PyCharm Run No mistakes
...
def FuncD(self):
...
self.temp = IOThread(IOFunc, *Targ, **Tkarg)
self.temp.start() # This is written in PyCharm Run No mistakes
...
...
Judging from the above , Should be python Run When compiling the code, you create QtThread Then I thought I had run out , Reclaim memory at the end of the function , Make a mistake . You need to keep it in the function manually ;FuncC Yes means that if the task of a child thread is to manage 、 New thread , You can allow local variables to remain .
For the time being, I am impressed by the above 2022 year 2 month 18 Japan .
边栏推荐
- Basic knowledge of pointer
- 有哪个瞬间让你觉得这个世界出bug了?
- Judging the number of leap years from 1 to N years
- For the first time in China, Chinatelecom 5g underground personnel positioning project is officially commercial: it can track the position in real time to ensure operation safety
- A deformation problem of Hanoi Tower
- Software packaging and deployment
- Real variable instance
- Common classes in QT
- New title of PTA
- 买卖股票的最佳时机
猜你喜欢

QQ情话糖果情话内容获取并保存
![[C language] implementation of magic square array (the most complete)](/img/b2/2595263b77e0abac667972bbfe0c8a.jpg)
[C language] implementation of magic square array (the most complete)

Std:: vector minutes

Dynamic memory allocation

Learning notes on February 5, 2022 (C language)

Fishing detection software

About the problem of kicad stuck in win10 version, version 6 x

多张动图怎样合成一张gif?仅需三步快速生成gif动画图片

Design and implementation of thread pool

System Verilog - thread
随机推荐
How to package rpm
@Font face fonts only work on their own domain - @font-face fonts only work on their own domain
电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备
A deformation problem of Hanoi Tower
Learning notes on February 5, 2022 (C language)
‘make_ unique’ is not a member of ‘std’
The difference between sizeof and strlen
How to deal with mining process
Golang channel reading data
如何裁剪动图大小?试试这个在线照片裁剪工具
Go语言Zap库Logger的定制化和封装使用详解
Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password
Learning notes on February 18, 2022 (C language)
Dynamic memory allocation
Single user mode
Character encoding minutes
3. Sequential structure multiple choice questions
C language LNK2019 unresolved external symbols_ Main error
Gif动图如何裁剪?收下这个图片在线裁剪工具
2022年广东高考分数线出炉,一个几家欢喜几家愁