【问题标题】:Passing arguments through QtGui.QAction to the triggered method通过 QtGui.QAction 将参数传递给触发的方法
【发布时间】:2013-01-12 12:27:18
【问题描述】:

假设我有一个类似的方法:

def open(self, opt):
    if opt == True:
    ...
    if opt == False:
    ...

如何使用 QtGui.QAction 将参数传递给它,例如:

self.openAct = QtGui.QAction("O&pen", self, shortcut="Ctrl+O",
            statusTip="Opens a location", triggered=self.open)

【问题讨论】:

    标签: python pyqt qtgui


    【解决方案1】:

    我找到答案是from functools import partial。它在This thread

    【讨论】:

      猜你喜欢
      • 2012-08-29
      • 2022-11-11
      • 1970-01-01
      • 2017-01-22
      • 1970-01-01
      • 2015-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多