XRC Cheat Sheet
Use "-1" instead of XRCID("ButtonName") to direct all clicks to one handler.
For handle to button, add to OnInit:
An XRC object name which matches a stock window ID (wxID_NEW, wxID_OPEN, and so on) will be recognized, and the appropriate ID will be applied to the generated item. For example, the following XML defines the "New" menu item:
<object class="wxMenuItem" name="wxID_NEW"> <label>New</label> <accel>Ctrl+N</accel> </object>
The Pythonic forms of the stock IDs (wx.ID_NEW) will not be recognized.
1 self.txt.SetValue( "Text for box." )
(Intro at end of document on purpose.)
This cheat sheet exists to aleviate steps 2,3,4:
Search on the wxPython wiki for "UsingXmlResources." (Generally, I've forgotten the name.)
Adapt UsingXmlResources' code to something that I like, to be a basic framework.
Scan for applicable pieces of UsingXmlResources, and search through the wxPython docs, to remember how to do the little things I want to do.
- Actually write the interesting code.
You are strongly invited to make this document more useful! If there's something that should be here, please add it!
General rule of thumb:
If it's a feature people use a lot, put it in here!
If it's a feature people use rarely, keep it out!
- Exercise good judgement in all other cases.
- Buttons are always clicked, so we put button clicking code in here.
- But buttons' labels rarely change, so we don't put that in here. Go look it up.
We want to get "that easy 90%", and just look up the remaining 10%.