سؤال

Let's say I have a method like:

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

how do I pass the argument to it with QtGui.QAction like:

self.openAct = QtGui.QAction("O&pen", self, shortcut="Ctrl+O",
            statusTip="Opens a location", triggered=self.open)
هل كانت مفيدة؟

المحلول

I found the answer it is from functools import partial. It was in This thread.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top