[PySide] Sender Method Difference

Ed Lipson edlipsongm at gmail.com
Fri Mar 27 19:10:39 CET 2020


Thanks for the prompt response. I read the JIRA, and got these to both work

# self.pushButtonAdd.clicked[bool].connect(lambda _, bflg='A':
self.add_tranb(bflg))

# self.pushButtonAddPlus.clicked[bool].connect(lambda _, bflg='AP':
self.add_tranb(bflg))
        # QObject.connect(self.pushButtonAdd, SIGNAL('clicked()'),
        #                 lambda bflg='A': self.add_tranb(bflg))
        # QObject.connect(self.pushButtonAdd, SIGNAL('clicked()'),
        #                 lambda bflg='AP': self.add_tranb(bflg))
It it getting the the edge of my Python skills to understand, but I
understand the C++ signature points.

I've time on my hands since being let go at the beginning of March, and now
with SARS COV2 I can't even go the the gym. So I'm coding little projects.
I appreciate the time you take to respond.

Thanks,
Ed


On Fri, Mar 27, 2020 at 11:16 AM Cristián Maureira-Fredes <
Cristian.Maureira-Fredes at qt.io> wrote:

> Hello,
>
> On 3/27/20 3:08 PM, Ed Lipson wrote:
> > Looking at
> >
> https://wiki.qt.io/Differences_Between_PySide_and_PyQt#sender.28.29_method_returns_None_when_used_within_a_partial_or_a_lambda
> (snip)
> > There is a separate thread on StackExchange about this where the lambda
> > is "lambda state, bname='a':func(bname)" but the state causes a Type
> > error because state is missing.
> > As stated in the Wiki, they work in PyQT
>
> You can find the discussion we had on the same
> topic here: https://bugreports.qt.io/browse/PYSIDE-909
>
> In a nutshell,
> the signals are selected by the arguments,
> the only variation of clicked is clicked(bool),
> so when you pass an argument it assumed is that one
> and it fails to convert your str to bool.
> The same with more than 1 argument, it will fail
> to connect to the signal.
>
> If you really need something like a clicked(str)
> signal, I recommend you create your own personalized
> signal.
>
> If you still believe that behaviour should
> be accepted, please open a Suggestion in our JIRA system.
>
> Cheers
>
> --
> Dr. Cristian Maureira-Fredes
> R&D Manager
>
> The Qt Company GmbH
> Erich-Thilo-Str. 10
> D-12489 Berlin
>
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Mika Harjuaho
> Sitz der Gesellschaft: Berlin,
> Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> https://lists.qt-project.org/listinfo/pyside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20200327/94028f69/attachment.html>


More information about the PySide mailing list