decorator - python装饰器在PyQt4中的应用
高洛峰
高洛峰 2017-04-17 13:52:27
0
2
344

我在pyqt的example中看到很多类似下面这样的语法,我查了些资料,但是不是很明白。

@QtCore.pyqtSlot(str, str)
def messageSlot(self, nickname, text):
    [...]

想在这里请教下大家 @QtCore.pyqtSlot(str, str) 这句话到干了哪些事情,起到了什么作用

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
大家讲道理

Define a slot function with two parameters through the @PyQt4.QtCore.pyqtSlot(str, str) decoration method

The decomposition is messageSlot = QtCore.pyqtSlot(str, str)(messageSlot)
First, QtCore.pyqtSlot(str, str) returns a function, assuming A
Then, the function runs A(messageSlot)

PHPzhong

Just understand it as messageSlot = QtCore.pyqtSlot(str, str)(messageSlot) That’s fine.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!