i want to create a dynamic number of buttons, what is the preffered method of doing this? create a custom button class or something and loop through my list of names creating a new instance each time?
Timothy Smith wrote:
i want to create a dynamic number of buttons, what is the preffered method of doing this? create a custom button class or something and loop through my list of names creating a new instance each time?
Yep, that would work, but whatever works best for each situation is fine.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Create a set of buttons.
If you need more, create more (remember to add to a sizer).
If you need different names, .SetLabel()
If you need fewer, .Hide() the buttons.
Dispatch action based on event.GetEventItem().GetLabel() .
Always remember to .Layout() the parent after any change.
- Josiah
···
Timothy Smith <timothy@open-networks.net> wrote:
i want to create a dynamic number of buttons, what is the preffered
method of doing this? create a custom button class or something and loop
through my list of names creating a new instance each time?
Josiah Carlson wrote:
···
Timothy Smith <timothy@open-networks.net> wrote:
i want to create a dynamic number of buttons, what is the preffered method of doing this? create a custom button class or something and loop through my list of names creating a new instance each time?
Create a set of buttons.
If you need more, create more (remember to add to a sizer).
If you need different names, .SetLabel()
If you need fewer, .Hide() the buttons.
Dispatch action based on event.GetEventItem().GetLabel() .
Always remember to .Layout() the parent after any change.- Josiah
yeah i was kind of hoping i could create them dynamiclly from my db
Timothy Smith wrote:
Josiah Carlson wrote:
i want to create a dynamic number of buttons, what is the preffered method of doing this? create a custom button class or something and loop through my list of names creating a new instance each time?
Create a set of buttons.
If you need more, create more (remember to add to a sizer).
If you need different names, .SetLabel()
If you need fewer, .Hide() the buttons.
Dispatch action based on event.GetEventItem().GetLabel() .
Always remember to .Layout() the parent after any change.- Josiah
yeah i was kind of hoping i could create them dynamiclly from my db
There's nothing to prevent you from doing that. I think that Josiah's message was just to remind you that sometimes you need to do more than just create the button.
···
Timothy Smith <timothy@open-networks.net> wrote:
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!