Toolbar Radio Button

Hello to all!
I am using a toolbar with three radio buttons as follows:

toolbar.Bind(wx.EVT_MENU_RANGE,
             self.OnToolbarButtonPressed,
             id=EVT_BUTTON_ONE,
             id2=EVT_BUTTON_THREE)

My question is:
How can I manually set a toolbar radio button like BUTTON_TWO to "pressed"?
I tried constructing and posting a similar event as follows but it did not work:

evt = wx.PyCommandEvent(wx.EVT_MENU_RANGE.typeId, EVT_BUTTON_TWO)
wx.PostEvent(self.GetEventHandler(), evt)

Thank you!

Nick

IIRC, myRadioButton2.SetValue(true) will work.

David

···

On 10/25/2016 07:41 AM, Nick D. wrote:

Hello to all!
I am using a toolbar with three radio buttons as follows:

toolbar.Bind(wx.EVT_MENU_RANGE,
             self.OnToolbarButtonPressed,
             id=EVT_BUTTON_ONE,
             id2=EVT_BUTTON_THREE)

My question is:
How can I manually set a toolbar radio button like BUTTON_TWO to "pressed"?
I tried constructing and posting a similar event as follows but it did not work:

evt = wx.PyCommandEvent(wx.EVT_MENU_RANGE.typeId, EVT_BUTTON_TWO)
wx.PostEvent(self.GetEventHandler(), evt)

Thank you!

Nick

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

Unfortunately that works only for normal radio buttons not for toolbar…

···

On Tuesday, October 25, 2016 at 5:46:49 PM UTC+2, David wrote:

IIRC, myRadioButton2.SetValue(true) will work.

David

On 10/25/2016 07:41 AM, Nick D. wrote:

Hello to all!
I am using a toolbar with three radio buttons as follows:

toolbar.Bind(wx.EVT_MENU_RANGE,
             self.OnToolbarButtonPressed,
             id=EVT_BUTTON_ONE,
             id2=EVT_BUTTON_THREE)

My question is:
How can I manually set a toolbar radio button like BUTTON_TWO to "pressed"?
I tried constructing and posting a similar event as follows but it did not work:

evt = wx.PyCommandEvent(wx.EVT_MENU_RANGE.typeId, EVT_BUTTON_TWO)
wx.PostEvent(self.GetEventHandler(), evt)

Thank you!

Nick

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

I think i found it on StackOverflow i need to use ToggleTool()
:slight_smile:

···

On Monday, December 5, 2016 at 10:37:39 AM UTC+1, Nick D. wrote:

Unfortunately that works only for normal radio buttons not for toolbar…

On Tuesday, October 25, 2016 at 5:46:49 PM UTC+2, David wrote:

IIRC, myRadioButton2.SetValue(true) will work.

David

On 10/25/2016 07:41 AM, Nick D. wrote:

Hello to all!
I am using a toolbar with three radio buttons as follows:

toolbar.Bind(wx.EVT_MENU_RANGE,
             self.OnToolbarButtonPressed,
             id=EVT_BUTTON_ONE,
             id2=EVT_BUTTON_THREE)

My question is:
How can I manually set a toolbar radio button like BUTTON_TWO to "pressed"?
I tried constructing and posting a similar event as follows but it did not work:

evt = wx.PyCommandEvent(wx.EVT_MENU_RANGE.typeId, EVT_BUTTON_TWO)
wx.PostEvent(self.GetEventHandler(), evt)

Thank you!

Nick

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).