23.01.2015 Views

Interfacce grafiche in Python - Agentgroup

Interfacce grafiche in Python - Agentgroup

Interfacce grafiche in Python - Agentgroup

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Registrazione di un<br />

event handler<br />

Per associare (registrare) un gestore di eventi<br />

(event handler) ad un evento di un widget si<br />

utilizza il metodo connect() del widget<br />

self.button.connect(“clicked”, self.hello, None)<br />

ESEMPI:<br />

helloworld.py<br />

L'evento che si vuole gestire è<br />

“clicked” (pressione del bottone):<br />

Si vuole associare un event<br />

handler all'oggetto button di<br />

tipo Button (bottone).<br />

Il metodo che si vuole <strong>in</strong>vocare è<br />

hello all'<strong>in</strong>terno della classe attuale<br />

(self.hello()).<br />

L<strong>in</strong>guaggi d<strong>in</strong>amici – A.A. 2010/2011<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!