Yes. If you for anstance want to connect an event to a
control, you need to know it's id. If you do:
p.buttonSizer.AddMany([
(wxButton(p, -1, 'Import file'), 0, 0, 5),
(wxButton(p, -1, 'Export File'), 0, 0, 5)])
How in the world would you be able to connect the events?
EVT_BUTTON(self, ???, self.OnImportButton)
EVT_BUTTON(self, ???, self.OnExportButton)
So you do:
IMPORT_BUTTON_ID = wxNewId()
EXPORT_BUTTON_ID = wxNewId()
p.buttonSizer.AddMany([
(wxButton(p, IMPORT_BUTTON_ID, 'Import file'), 0, 0, 5),
(wxButton(p, EXPORT_BUTTON_ID, 'Export File'), 0, 0, 5)])
EVT_BUTTON(self, IMPORT_BUTTON_ID, self.OnImportButton)
EVT_BUTTON(self, EXPORT_BUTTON_ID, self.OnExportButton)
But on the other hand, if you do:
impBtn = wxButton(p, IMPORT_BUTTON_ID, 'Import file',
wxPoint(5, 5))
you can continue with
EVT_BUTTON(self, impBtn.GetId(), self.OnImportButton)
/Magnus
···
At 00:52 2001-11-04 +0200, Hugo van der Merwe wrote:
I don't think I've done a thorough enough learning of the way wxpython
fits together, trying to get things going based on examples I've seen.
(E.g. wxWindowID's - when must one use wxNewId() and when can one just
use -1? It looked like this ID was just for when you need to identify a
window, this right?)
--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se