I've already sent too much time trying to get a choice dialog to work and
will hope that the experts on this list will be able to tell me what is
wrong in the attached script. I'm sure it is something simple that I am
missing. I am using wxPython 2.1.13 on Win NT4 and Win 98.
Also, how do I grey out menu items which are not active?
Any suggestions will be appreciated. Thanks in advance.
# Prevent TreeCtrl from displaying all items after destruction
self.dying = false
self.mainmenu = wxMenuBar()
# Make a Find menu
menu = wxMenu()
mID = NewId()
menu.Append(mID, '&Choice', 'Test choice')
EVT_MENU(self, mID, self.OnTestChoice)
mID = NewId()
menu.Append(mID, 'E&xit', 'Get the heck outta here!')
EVT_MENU(self, mID, self.OnFileExit)
# Set up a TextCtrl on the Display page
# This will be an HTML page at some point
self.dispPage = wxTextCtrl(self.splitterDisplay, -1, '',
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY)
# Set up a log on the right page
self.log = wxTextCtrl(self.splitterDisplay, -1, '',
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
(w, self.charHeight) = self.log.GetTextExtent('X')
#self.WriteText('wxPython Demo Log:\n')
# add the windows to the splitter and split it.
> I've already sent too much time trying to get a choice dialog to work and
> will hope that the experts on this list will be able to tell me what is
> wrong in the attached script. I'm sure it is something simple that I am
> missing. I am using wxPython 2.1.13 on Win NT4 and Win 98.
It would be helpful next time if you would also specify what you expected and
what is not happening correctly. Maybe then I could answer right away
without having to take the time to run the code.
There is nothing wrong with your use of wxChoice, but there is with the
window you place it on. You are not doing anything to manage it's size, and
so it stays size (20,20) and so you can never see the wxChoice which is
located at (80, 50). The wxSplitterWindow will autmatically manage the size
of it's child windows, you are using wxTextCtrls which is okay. But then you
create a wxPanel as a child of the wxTextCtrl which doesn't expect to have
child windows and doesn't know what to do with them if it has.
If you let us know what you are trying to accomplish then somebody can help
you better, but here are some suggestions:
1. if you want the panel to fill its half of the splitter, then create it as
a child of the splitter and leave the TextCtrl out of it.
2. If you want it to show up side by side with the text ctrl then put them
both on a new panel, make that panel be the child of the splitter, and teach
the panel how to layout its children, (with sizers, layout contraints, or
3. If you want it to float above the rest then put the choice in a wxDialog
instead of a panel.
4. If you want to flip between several windows all within the splitter, then
add them as pages in a notebook and let the notebook be the child of the
> Also, how do I grey out menu items which are not active?