Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
_tqobject.pyzdoc
Go to the documentation of this file.
1/**
2\pythondoc TQObject
3
4The `Connect` method of TQObject (and thus of any class deriving from it, like
5the GUI widgets) directly accepts a Python callable as the slot:
6
7\code{.py}
8import ROOT
9
10def on_clicked():
11 print("button clicked")
12
13button = ROOT.TGTextButton(parent, "&Draw", 10)
14button.Connect("Clicked()", on_clicked)
15\endcode
16
17The arguments emitted by the signal are forwarded to the callable, as far as
18its signature accepts them. The connection keeps the callable alive; it can be
19undone with `Disconnect`, passing the same signal and callable:
20
21\code{.py}
22button.Disconnect("Clicked()", on_clicked)
23\endcode
24
25The C++ signature `Connect(signal, receiver_class, receiver, slot)` remains
26available.
27
28\endpythondoc
29*/