I have a question on the excelAddin.py sample in the win32com\demos folder.

We create a Tool Bar, add a button to it,
btnMyButton = cbcMyBar.Controls.Add(Type=constants.msoControlButton,
Parameter="Greetings")

'register' the button with the ButtonEvent class,
btnMyButton=self.toolbarButton = DispatchWithEvents(btnMyButton, ButtonEvent)

and set a couple of properties.
btnMyButton.Caption = "&Python"
btnMyButton.TooltipText = "Python rules the World"

In the OnClick event handler of the ButtonEvent class,
class ButtonEvent:
    def OnClick(self, button, cancel):

1. How is the 'button' argument related to the actual button that was
clicked? It showed up as a PyIDispatch object when I tried printing
it.

2. Assuming there is more than one button that can  be clicked, how
would I access some of the properties of the button instance that was
actually clicked by the user?

Thanks
Sriram
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to