wxPython | FindToolForPosition() function in python Last Updated : 02 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn about FindToolForPosition() function of class wx.ToolBar of wxPython. FindToolForPosition() is used to find a tool for the given mouse position. It takes x and y position of the window. Syntax: wx.ToolBar.FindToolForPosition(self, x, y) Parameters : ParameterInput TypeDescriptionxintX position.yintY position. Return Type: wx.ToolBarToolBase Code Example 1: Python3 import wx class Example(wx.Frame): global count count = 0; def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) pnl = wx.Panel(self) self.toolbar = self.CreateToolBar() # Add Tools Using AddTool function rtool = self.toolbar.AddTool(13, 'twoTool', wx.Bitmap('wrong.png'), shortHelp ="Simple Tool2") self.toolbar.Realize() self.SetSize((350, 250)) self.SetTitle('Control') self.Centre() # print wx.ToolBarToolBase object of tool print(self.toolbar.FindToolForPosition(5, 5)) def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output : <wx._core.ToolBarToolBase object at 0x0000009B92B041F0> Code Example 2: Python3 import wx class Example(wx.Frame): global count count = 0; def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) pnl = wx.Panel(self) self.toolbar = self.CreateToolBar() # Add Tools Using AddTool function rtool = self.toolbar.AddTool(13, 'twoTool', wx.Bitmap('wrong.png'), shortHelp ="Simple Tool2") stool = self.toolbar.AddTool(14, 'twoTool', wx.Bitmap('user.png'), shortHelp ="Simple Tool2") self.toolbar.Realize() self.SetSize((350, 250)) self.SetTitle('Control') self.Centre() # print wx.ToolBarToolBase object of tool print(self.toolbar.FindToolForPosition(40, 5).GetLabel()) def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output: twoTool Comment More infoAdvertise with us Next Article wxPython | GetToolPos() function in python R RahulSabharwal Follow Improve Article Tags : Python Python-wxPython Practice Tags : python Similar Reads wxPython | FindControl() function in Python In this particular article we are going to learn about FindControl() function of wx.ToolBar class of wxPython. FindControl() function is used to returns a pointer to the control identified by id or None if no corresponding control is found. It takes only one parameter 'id'. Syntax : wx.ToolBar.FindC 2 min read wxPython| FindById() function in python In this article we are going to learn a simple function that is FindById() in wx.ToolBar class of wxPython. FindById is a simple function and returns a pointer to the tool identified by id or None if no corresponding tool is found. FindById() takes only single parameter that is id of a particular to 2 min read wxPython - FindString() function in wx.RadioBox In this article we are going to learn about FindString() function associated with wx.RadioBox class of wxPython. FindString() function is simply used to find a button matching the given string, returning the position if found, or NOT_FOUND if not found. It takes a string argument to match string and 2 min read wxPython | GetToolPos() function in python In this article we are going to learn about GetToolPos() function associated with wx.ToolBar class of wxPython. GetToolPos() function simply returns the tool position in the toolbar, or NOT_FOUND if the tool is not found. GetToolPos() function only takes toolId(ID of the tool in question, as passed 2 min read Python - Move() function in wxPython In this particular article we will learn, how can we move our window to a particular point. This can be achieved using Move() function in wx.Window class of wxPython. Move() takes x and y points to move window to a particularx, y point. Syntax : wx.Move(self, x, y, flags=SIZE_USE_EXISTING) Parameter 1 min read wxPython | GetMargins() function in python In this article we are going to learn about GetMargins() function of class wx.ToolBar in wxPython. GetMargins() function returns the left/right and top/bottom margins, which are also used for inter-toolspacing. GetMargins takes no parameters. Syntax: wx.ToolBar.GetMargins(self) Parameters: No Parame 2 min read Like