简体   繁体   中英

Setting A Generator As The Argument Of A PyQt4 Signal

I want to use a generator as the argument passed by a PyQt4 signal, and I am not sure as to the cleanest way. I could just do something like elementChosen=QtCore.pyqtSignal(type((i for i in xrange (i)))) , but this just looks ugly. Any suggestions?

You can use the types module to make the code look less ugly.

from types import GeneratorType

elementChosen = QtCore.pyqtSignal(GeneratorType)

documentation: http://docs.python.org/library/types.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM