PyQt and QSignalMapper/lambdas - multiple signals, single slot

浪尽此生 提交于 2019-12-01 14:11:48

You can use functools.partial (link to the documentation):

import functools
...

# note that these are the 'new style' slot connections (not necessarily needed)
self.menu_entry_x.triggered.connect(functools.partial(myfunc, x))
self.menu_entry_y.triggered.connect(functools.partial(myfunc, y))

The example is above is very basic, but I could elaborate if you have more questions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!