Re: Bug in wxPython? MessageDialog.ShowModal() returning always zero on OS X

Robin Dunn <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Jari Nevala wrote:
> Hi,
>
> I noticed recently that when a MessageDialog is created in a thread and
> its ShowModal() is called, it always returns 0 on OS X. This is an
> error, because it should return the wx.ID of the button pressed. On
> Windows this does not happen.
>
> When the MessageDialog is created in the main thread, the ShowModal()
> returns correct value on OS X and PC.
>
> The Mac I used to reproduce this problem is Macbook Air with OS X
> version 10.9.5. wxPython version is 3.0.2.0. My PC is running Windowsx
> 8.1 and also has wxPython 3.0.2.0 installed.
>
> Below is code to reproduce the problem. See the comments.
> Code also available in pastebin: http://pastebin.com/QbNkw5gz
>
> So is this a bug in wxPython?

It's a known issue, but it only happens with stock dialogs shown before 
the MainLoop starts.  So the easy fix is to just move that code to a 
method and use wx.CallAfter or wx.CallLater in OnInit to invoke it right 
after the MainLoop starts processing events.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.