[wxPython] QT type signals?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] QT type signals?

Bill Eldridge-2

Wondering if I can do something like QT's linked signals in wxPython:

connect(self.button,SIGNAL("clicked()"),otherbutton,SIGNAL("clicked()"))
???

Thanks,
Bill
--
Bill Eldridge
Radio Free Asia
[hidden email]


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] QT type signals?

Robin Dunn
>
> Wondering if I can do something like QT's linked signals in wxPython:
>
> connect(self.button,SIGNAL("clicked()"),otherbutton,SIGNAL("clicked()"))
> ???
>

I don't know QT so I can't say for sure, but I assume that this statement
causes the same event handler to be called for each button?  If so then you
can do that easily:

    EVT_BUTTON(self.button, bID, self.OnClicked)
    EVT_BUTTON(otherbutton, otherID, self.OnClicked)

If it means that when self.button is clicked to also send a clicked event to
otherbutton, than that can be done to, although not as elegantly:

    # EVT_BUTTON handler for self.button
    def OnClicked(self, event):
        evt = wxCommandEvent(wxEVT_COMMAND_BUTTON_CLICKED,
                             otherbutton.GetId())
        otherbutton.Command(evt)


(I'm guessing on this one, I'd have to try it to be sure, but something like
this or similar should work.)

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users