当前位置:网站首页>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 .
边栏推荐
- Design and implementation of thread pool
- [deep learning] multi label learning
- 【Try to Hack】vulnhub DC1
- QT file reading -qfile
- From 408 to independent proposition, 211 to postgraduate entrance examination of Guizhou University
- About%*s and%* s
- Single user mode
- Function of getinstance() method
- JS capture, target, bubble phase
- Common dynamic memory errors
猜你喜欢

Learning C language today is the first time to learn C language. In college, C linguistics is not good, but I want to make progress, so I found a beep video on the Internet to learn C language

Gif动图如何裁剪?收下这个图片在线裁剪工具
![[try to hack] vulhub shooting range construction](/img/fc/6057b6dec9b51894140453e5422176.png)
[try to hack] vulhub shooting range construction

User defined data type - structure

Position (5 ways)

JS select all exercise

Build a minimalist gb28181 gatekeeper and gateway server, establish AI reasoning and 3D service scenarios, and then open source code (I)

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat

15 -- 最接近原点的 K 个点

Fishing detection software
随机推荐
The best time to buy and sell stocks
Using Sphinx to automatically generate API documents from py source files
[Ocean University of China] information sharing for the first and second examinations of postgraduate entrance examination
How to cut the size of a moving picture? Try this online photo cropping tool
多张动图怎样合成一张gif?仅需三步快速生成gif动画图片
Qcodeeditor - QT based code editor
Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
About%*s and%* s
Dynamic memory allocation
Character encoding minutes
How to make GIF animation online? Try this GIF online production tool
QT database connection deletion
NBD Network Block Device
[try to hack] vulhub shooting range construction
Mining procedure processing
One question per day,
Qt: Pro project file
A deformation problem of Hanoi Tower
QQ love talk candy love talk content acquisition and storage
Brain tree (I)