wxPython - Image on button in Python Last Updated : 24 Feb, 2023 Comments Improve Suggest changes Like Article Like Report In this particular article we will learn how can we add image to a button in GUI using wxPython. This can be achieved using BitmapButton() constructor of wx.BitmapButton class in wx. Following Window Styles are supported : wx.BU_LEFT: Left-justifies the bitmap label.wx.BU_TOP: Aligns the bitmap label to the top of the button.wx.BU_RIGHT: Right-justifies the bitmap label.wx.BU_BOTTOM: Aligns the bitmap label to the bottom of the button. Syntax : wx.StaticText(self, parent, id=ID_ANY, bitmap=NullBitmap, pos=DefaultPosition, size=DefaultSize, style=0, validator= DefaultValidator, name=StaticTextNameStr) Parameters : ParameterInput TypeDescriptionparentwx.WindowParent window. Should not be None.idwx.WindowIDControl identifier. A value of -1 denotes a default value.bitmapwx.BitmapBit to be displayed.poswx.PointWindow position.sizewx.WindowWindow size.stylelongWindow style.validatorwx.ValidatorWindow validator.namestringWindow name. Example Code: Python3 # import wxPython import wx # event function for button def onButton(event): print("Button pressed.") app = wx.App() frame = wx.Frame(None, -1, 'win.py') frame.SetDimensions(0, 0, 200, 70) panel = wx.Panel(frame, wx.ID_ANY) # open image from disk bmp = wx.Bitmap("/home/rahul101/Desktop/wxPython/images.png", wx.BITMAP_TYPE_ANY) # create image button using BitMapButton constructor button = wx.BitmapButton(panel, id = wx.ID_ANY, bitmap = bmp, size =(bmp.GetWidth()+10, bmp.GetHeight()+10)) button.Bind(wx.EVT_BUTTON, onButton) button.SetPosition((10, 10)) frame.Show() frame.Centre() app.MainLoop() Output : Comment More infoAdvertise with us Next Article wxPython - Image on button in Python R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads Button in wxPython - Python In this article we are going to learn how can we add buttons to a frame in wxPython. This can be done by using the Button() constructor of wx.Button class. Following styles are supported in this class: wx.BU_LEFT: Left-justifies the label. Windows and GTK+ only.wx.BU_TOP: Aligns the label to the top 2 min read wxPython - Add Image in Button In this article we are going to learn that, how can we add image in a button. So first of all we will create a wx.Bitmap object and initialize with the image we want to add to button. After this we will use SetBitmap() function associated with wx.Button class of wxPython. SetBitmap() function takes 1 min read Python | Add image on a Tkinter button Tkinter is a Python module which is used to create GUI (Graphical User Interface) applications with the help of varieties of widgets and functions. Like any other GUI module it also supports images i.e you can use images in the application to make it more attractive. Image can be added with the help 3 min read wxPython - Disable Radio button In this article we are going to learn about how can we disable a radio button present in a frame. Sometimes when we dont want user to press a button we can disable a button and the button become unclickable. In order to disable a button we can use Disable() function associated with wx.RadioButton cl 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 Like