[wxPython] Layout of Dialogs.

Hello List!

I've been having a hard time using a wxBoxSizer in a python class I'm writing
which extends wxDialog.
What is the typical way of doing this?

Using the code below on Debian GNU/Linux Potato running wxGTK 2.1.15 I get
the following errors:
--- Begin Errors:
Gtk-WARNING **: invalid class type `(unknown)' in cast to `GtkObject'
Gtk-CRITICAL **: file gtkwidget.c: line 2725 (gtk_widget_event): assertion
`GTK_IS_WIDGET (widget)' failed.
--- End Errors.

Here's the class I'm trying to write; it's just a simple dialog which allows
the programmer to pass in handler funcs:

class ListDialog(wxDialog) :
    def __init__(self,
  parent=NULL,
  ident=-1,
  message="Here's a list:",
  items=[],
  boxstyle=0,
  lb_select_callback = lambda event : None,
  lb_dclick_callback = lambda event : None,
  title="List Dialog",
  pos=wxDefaultPosition,
  size=wxDefaultSize,
  style=wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,
  name="listdialog"
           ) :
        wxDialog.__init__(self, parent, ident, title, pos, size, style,
name)
        self.label = wxStaticText(self, -1, message)
        self.listbox = wxListBox(self, -1, choices=items, style=boxstyle)

        # Layout:
        self.SetAutoLayout(true)

        sizer = wxBoxSizer(wxVERTICAL)
        sizer.Add(self.label, 0, wxCENTER)
        sizer.Add(self.listbox, 1, wxEXPAND)
        #sizer.Fit(self)
        self.SetSizer(sizer)

        # Events:
        EVT_LISTBOX(self, self.listbox.GetId(), lb_select_callback)
        EVT_LISTBOX(self, self.listbox.GetId(), lb_dclick_callback)
        return

Thanks,
ax-left

IMPORTANT NOTICE: If you are not using HushMail, this message could have been read easily by the many people who have access to your open personal email messages.
Get your FREE, totally secure email address at http://www.hushmail.com.

Using the code below on Debian GNU/Linux Potato running wxGTK 2.1.15 I get
the following errors:
--- Begin Errors:
Gtk-WARNING **: invalid class type `(unknown)' in cast to `GtkObject'
Gtk-CRITICAL **: file gtkwidget.c: line 2725 (gtk_widget_event): assertion
`GTK_IS_WIDGET (widget)' failed.
--- End Errors.

Here's the class I'm trying to write; it's just a simple dialog which

allows

the programmer to pass in handler funcs:

I don't see anything right off that's wrong with your code. Usually errors
like that have to do with lower level prolems. What version of gtk is on
your system?

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!