[pygtk] gtk.MessageDialog doesn't work on windows

Timo timovwb at gmail.com
Thu Oct 23 17:33:58 WST 2008


Frédéric schreef:
> Le 23/10/2008, "Timo" <timovwb op gmail.com> a écrit:
>
>   
>> def errorDlg(string):
>>    s = "An error occured during this operation!"
>>    errordlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
>> message_format=s, buttons=gtk.BUTTONS_OK)
>>    errordlg.format_secondary_text(string)
>>    errordlg.run()
>>    errordlg.destroy()
>>     
>
> Strange, I use such dialog in Windows, and it works fine. I think your
> problem is elsewhere. In what context do you open this dialog? 
It gets called in here:

def getLink(site):
    try:
        #do my link stuff
    except urllib2.HTTPError, e: 
        #print "HTTP request failed with error %d (%s)" % (e.code, e.msg)  
        errorDlg("HTTP request failed with error %d (%s)" % (e.code, e.msg))

The print was just for checking if it really gets there, and it does, so 
the urllib2 stuff works.

> Is it
> from the main loop thread? Or from another thread?
>
>   
The getLink() from above does indeed get called from within a thread, 
not the main loop. Would this be the problem? Because, in the same 
thread, I'm also moving a progressbar and filling up a treeview, and 
they seem to work fine.

Timo



More information about the pygtk mailing list