Toolbar Radio Button

43 views
Skip to first unread message

Nick D.

unread,
Oct 25, 2016, 8:41:13 AM10/25/16
to wxPython-users
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

David Woods

unread,
Oct 25, 2016, 11:46:49 AM10/25/16
to wxpytho...@googlegroups.com

IIRC, myRadioButton2.SetValue(true) will work. 

David

--
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.

Nick D.

unread,
Dec 5, 2016, 4:37:39 AM12/5/16
to wxPython-users

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

Nick D.

unread,
Dec 5, 2016, 9:38:36 AM12/5/16
to wxPython-users
I think i found it on StackOverflow i need to use ToggleTool()
:)
Reply all
Reply to author
Forward
0 new messages