AGW Logo

agw_title gradientbutton

GradientButton is another custom-drawn button class which mimics Windows CE mobile gradient buttons.

description Description

GradientButton is another custom-drawn button class which mimics Windows CE mobile gradient buttons, using a tri-vertex blended gradient plus some ClearType bold font (best effect with Tahoma Bold). GradientButton supports:

  • Triple blended gradient background, with customizable colours;
  • Custom colours for the “pressed” state;
  • Rounded-corners buttons;
  • Text-only or image+text buttons.

And a lot more. Check the demo for an almost complete review of the functionalities.

usage Usage

Usage example:

import wx
import wx.lib.agw.gradientbutton as GB

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "GradientButton Demo")

        panel = wx.Panel(self, -1)

        # One button without bitmap
        button_1 = GB.GradientButton(panel, -1, None, "Hello World", (100, 50))

        # One button with bitmap
        my_bitmap = wx.Bitmap("my_bitmap.png", wx.BITMAP_TYPE_PNG)
        button_2 = GB.GradientButton(panel, -1, my_bitmap, "GradientButton", (100, 150))

# our normal wxApp-derived class, as usual

app = wx.PySimpleApp()

frame = MyFrame(None)


This code snippet can be downloaded, see this example script.


Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.

platforms Supported Platforms

GradientButton has been tested on the following platforms:
  • Windows (Windows XP).

styles Window Styles

No particular window styles are available for this class.

events Events Processing

This class processes the following events:

Events processing for gradientbutton
Event Name Description
wx.EVT_BUTTON Process a wx.wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.

license License And Version

GradientButton is distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 09 Feb 2012, 21.00 GMT

Version 0.3

Module author: Andrea Gavana <>

hierarchy Inheritance Diagram

Inheritance diagram for module: gradientbutton

Inheritance diagram of gradientbutton.GradientButton, gradientbutton.GradientButtonEvent

svn_main SVN Revisions

A graphical representation of the SVN commits in the last year.

Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.


Revision Graph For gradientbutton

2to3 Python 3 Issues (via 2to3)

No issues have been detected by