]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-07/generic_button.py
   2 import wx
.lib
.buttons 
as buttons
 
   4 class GenericButtonFrame(wx
.Frame
): 
   6         wx
.Frame
.__init
__(self
, None, -1, 'Generic Button Example',  
   8         panel 
= wx
.Panel(self
, -1) 
  10         sizer 
= wx
.FlexGridSizer(1, 3, 20, 20) 
  11         b 
= wx
.Button(panel
, -1, "A wx.Button") 
  15         b 
= wx
.Button(panel
, -1, "non-default wx.Button") 
  19         b 
= buttons
.GenButton(panel
, -1, 'Generic Button') 
  22         b 
= buttons
.GenButton(panel
, -1, 'disabled Generic') 
  26         b 
= buttons
.GenButton(panel
, -1, 'bigger') 
  27         b
.SetFont(wx
.Font(20, wx
.SWISS
, wx
.NORMAL
, wx
.BOLD
, False)) 
  29         b
.SetBackgroundColour("Navy") 
  30         b
.SetForegroundColour("white") 
  31         b
.SetToolTipString("This is a BIG button...") 
  34         bmp 
= wx
.Image("bitmap.bmp", wx
.BITMAP_TYPE_BMP
).ConvertToBitmap() 
  35         b 
= buttons
.GenBitmapButton(panel
, -1, bmp
) 
  38         b 
= buttons
.GenBitmapToggleButton(panel
, -1, bmp
) 
  41         b 
= buttons
.GenBitmapTextButton(panel
, -1, bmp
, "Bitmapped Text", 
  43         b
.SetUseFocusIndicator(False) 
  46         b 
= buttons
.GenToggleButton(panel
, -1, "Toggle Button") 
  51 if __name__ 
== '__main__': 
  52     app 
= wx
.PySimpleApp() 
  53     frame 
= GenericButtonFrame()