wxPython - Change Cursor on hover on Button Last Updated : 23 Jan, 2022 Comments Improve Suggest changes Like Article Like Report In this article we will learn that how can we change cursor when it hovers on Button present in frame. We need to follow some steps as followed. Step 1- Create a wx.Image object with image you want to use as cursor image. Step 2- Create a wx.Cursor object and pass wx.Image object above created. Step 3- Set the cursor using SetCursor() function. Syntax: wx.Button.SetCursor(cursor)Parameters: ParameterInput TypeDescriptioncursorwx.Cursorcursor to be set. Code Example: Python3 import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) self.pnl = wx.Panel(self) # CREATE BUTTON AT POINT (20, 20) self.st = wx.Button(self.pnl, id = 1, label ="Button", pos =(20, 20), size = wx.DefaultSize, name ="button") # CREATE CURSOR OBJECT c = wx.Cursor(wx.Image('pointer.png')) # SET c AS CURSOR self.st.SetCursor(c) self.SetSize((350, 250)) self.SetTitle('wx.Button') self.Centre() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output Window: Comment More infoAdvertise with us Next Article wxPython - Change Cursor on hover on Button R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Python wxPython-Button Practice Tags : python Similar Reads wxPython - Change Foreground Colour of Button In this article we will learn how can we change the foreground colour of the button or the font colour of the button. To do this we will use SetForegroundColour() function associated with wx.Button class of wxPython. SetForegroundColour() function simply takes wx.Colour argument for the foreground. 1 min read wxPython - Change cursor for ToolBar In this article will learn how can we change the cursor to a custom image cursor when it hovers over the toolbar. To do this we need to follow some steps as follows. Step 1: Create wx.Image object of the image you like. Step 2: Create wx.Cursor object passing image as parameter. Step 3: Set cursor f 1 min read wxPython - change size of Button In this article we are going to learn about SetSize() function associated with wx.Button class of wxPython. SetSize() function is simply used to change the size of the button present in the frame. SetSize function takes a wxSize argument to change the size of button. Syntax: wx.Button.SetSize(self, 1 min read wxPython - Change Button Label Font In this article we are going to learn that how can we change the font of the label text present on the button present in the frame. We need to follow some steps as follows: Step 1: Create a wx.Font object. Step 2: Add different attributes of font in parameters like: family, style etc. Step 3: Set fo 1 min read wxPython - Change Background colour of Button In this article we are going to learn about how can we change background colour of a button present in a frame. We use SetBackgroundColour() function to set background colour of the button to some different colour. It takes a wx.Colour class object as an argument. Syntax: wx.Button.SetBackgroundColo 1 min read Like