wxPython and wxRuby

You'd think that two libraries to interface to wxWindows would be fairly identical, but it turns out not to be the case. For example, wxRuby happily allows this:

	cred_box = StaticBox.new(self, -1, "&Credentials", Point.new(8,16), Size.new(200,110))
	StaticText.new(cred_box,-1, "&Username:", Point.new(8,24),Size.new(64,23))
	txtUsername = TextCtrl.new(cred_box, CFG_USERNAME, "", Point.new(78,24))

while wxPython fails with wxStaticBox can't be used as a window parent in the same case:

	box = wxStaticBox(self,-1,"&Credentials",wxPoint(8,16),wxSize(200,110))
	wxStaticText(self,-1,"&Username:",wxPoint(16,36),wxSize(64,23))
	self.txtUsername = wxTextCtrl(self,CFG_USERNAME,"",wxPoint(86,36))

The wxPython docs (which incidentally are a better wxRuby reference than the wxRuby docs!) seem to indicate that sizers is the correct way to do this, but that seems to work only if you have a single wxStaticBox in your dialog. I haven't quite figured out how to make a sizer actually lay things out in the way I expect.

— Gordon Weakliem at permanent link