StdDialogButtonSizer - Crash for anyone else?

Does the following code crash for anyone else? It works on my
Vista machine but fails on my Macbook. Want to confirm before
I file a bug report.

import wx

if __name__ == '__main__':
    app = wx.PySimpleApp()
    
    f = wx.Frame(None)
    s = f.Sizer = wx.StdDialogButtonSizer()
    s.AddButton(wx.Button(f, wx.ID_SAVE, '&Save'))
    s.AddButton(wx.Button(f, wx.ID_CANCEL, '&Cancel'))
    s.Realize()
    
    f.Show()
    app.MainLoop()

Kevin Watters wrote:

Does the following code crash for anyone else? It works on my
Vista machine but fails on my Macbook. Want to confirm before
I file a bug report.

import wx

if __name__ == '__main__':
    app = wx.PySimpleApp()
    
    f = wx.Frame(None)
    s = f.Sizer = wx.StdDialogButtonSizer()
    s.AddButton(wx.Button(f, wx.ID_SAVE, '&Save'))
    s.AddButton(wx.Button(f, wx.ID_CANCEL, '&Cancel'))
    s.Realize()
    
    f.Show()
    app.MainLoop()

Works great for me, no crash, just a window with "Cancel" in it.
What OS/version of wxPython are you using?

~ $ python
  13:18
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx

if __name__ == '__main__':

... app = wx.PySimpleApp()
...
... f = wx.Frame(None)
... s = f.Sizer = wx.StdDialogButtonSizer()
... s.AddButton(wx.Button(f, wx.ID_SAVE, '&Save'))
... s.AddButton(wx.Button(f, wx.ID_CANCEL, '&Cancel'))
... s.Realize()
...
... f.Show()
...
True

print __name__

__main__

···

app.MainLoop()

--
Best regards
Florian Mayer

GPG public key: http://florianmayer.fl.funpic.de/name/name.gpg
Jabber: name@jabber.org
ICQ: 446504088
Aim: segfaulthunter
Yahoo: segfaulthunter
IRC: name @ irc.freenode.net
Secondary email: segfaulthunter@gmail.com

Hi Kevin,

Kevin Watters wrote:

Does the following code crash for anyone else? It works on my
Vista machine but fails on my Macbook. Want to confirm before
I file a bug report.

import wx

if __name__ == '__main__':
    app = wx.PySimpleApp()
        f = wx.Frame(None)
    s = f.Sizer = wx.StdDialogButtonSizer()
    s.AddButton(wx.Button(f, wx.ID_SAVE, '&Save'))
    s.AddButton(wx.Button(f, wx.ID_CANCEL, '&Cancel'))
    s.Realize()
        f.Show()
    app.MainLoop()
  

Does not crash (Win XP, wxPython 2.6.3.3) but only shows one button. If I add a panel or change it to use a dialog then both buttons are shown, dialog example follows.

import wx

if __name__ == '__main__':
    app = wx.PySimpleApp()
       d = wx.Dialog(None)
    t = wx.TextCtrl(d)
       s = wx.StdDialogButtonSizer()
    s.AddButton(wx.Button(d, wx.ID_SAVE, '&Save'))
    s.AddButton(wx.Button(d, wx.ID_CANCEL, '&Cancel'))
    s.Realize()
       s2 = wx.BoxSizer(orient=wx.VERTICAL)
    s2.AddWindow(t)
    s2.AddWindow(s)

    d.SetSizerAndFit(s2)
    d.ShowModal()
    d.Destroy()
    app.MainLoop()

Werner

On wx2.8.1.1 on MacOS-X Tiger, it crashes for me with a Bus error at “s.Realize()”

···

On 2/28/07, Werner F. Bruhin < werner.bruhin@free.fr> wrote:

Hi Kevin,

Kevin Watters wrote:

Does the following code crash for anyone else? It works on my

Vista machine but fails on my Macbook. Want to confirm before
I file a bug report.

import wx

if name == ‘main’:
app = wx.PySimpleApp()

f = wx.Frame(None)
s = f.Sizer = wx.StdDialogButtonSizer()
s.AddButton(wx.Button(f, wx.ID_SAVE, '&Save'))
s.AddButton(wx.Button(f, wx.ID_CANCEL, '&Cancel'))
s.Realize()

f.Show()
app.MainLoop()

Does not crash (Win XP, wxPython 2.6.3.3) but only shows one button. If
I add a panel or change it to use a dialog then both buttons are shown,

dialog example follows.

import wx

if name == ‘main’:
app = wx.PySimpleApp()

d = wx.Dialog(None)
t = wx.TextCtrl(d)

s = wx.StdDialogButtonSizer()

s.AddButton(wx.Button(d, wx.ID_SAVE, ‘&Save’))
s.AddButton(wx.Button(d, wx.ID_CANCEL, ‘&Cancel’))
s.Realize()

s2 = wx.BoxSizer(orient=wx.VERTICAL)
s2.AddWindow(t)

s2.AddWindow(s)

d.SetSizerAndFit(s2)
d.ShowModal()
d.Destroy()
app.MainLoop()

Werner


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


Stephen Hansen
Development
Advanced Prepress Technology

shansen@advpubtech.com
(818) 748-9282

OK, so it's not just my install--and the example with a panel crashes as well.

I'll inform the "authorities."

Kevin Watters wrote:

Does the following code crash for anyone else? It works on my
Vista machine but fails on my Macbook. Want to confirm before
I file a bug report.

No need for a report, I've just fixed the bug. Thanks!

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!