runtimeerror missing handler python glade -
this piece of code
class gui_manage(): def delete_event(self , widget , data): false print 'delete' # ####################### # define functions here example : start_download(self ,widget) ######################################## def start_download( self , widget ): print 'add_url_clicked' def __init__(self): builder = gtk.builder() builder.add_from_file('gui.glade') win=builder.get_object('add_url_win') text_entry= builder.get_object('url_entry') signals ={ 'delete_event' : self.delete_event , 'destroy' : self.destroy , 'cancel_button_clicked' : self.delete_event , 'addpaused_button_clicked' : self.addpaused , 'start_download_clicked' : self.start_download , 'addpaused_button_clicked' : self.addpaused } builder.connect_signals(signals)
the glade file shows corresponding lines:
<object class="gtkbutton" id="start_download"> <property name="label" translatable="yes">start download</property> <property name="visible">true</property> <property name="can_focus">true</property> <property name="receives_default">true</property> <property name="tooltip_text" translatable="yes">start download ...</property> <property name="use_action_appearance">false</property> <signal name="clicked" handler="start_download" swapped="no"/>'
i got error :
gui_manage.py:45: runtimewarning: missing handler 'start_download' builder.connect_signals(signals)
however delete_event()
method called clicked ' event of cancel button ' successfully.
in brief, methods defined same way, connected in same dictionary, although missing!
it work :
'def start_download( self , object ): print 'add_url_clicked''
instead of
'def start_download( self , widget ): print 'add_url_clicked''
&
'self.signals = {}'
instead of
'signals = {}'
&
'self.builder.connect_signals(self)'
instead of
'self.builder.connect_signals(signals)'
thancks all
Comments
Post a Comment