X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8eca4fef106b8327e2e55636de3f68a511a4c392..30e24d9dd5a5abf1c9a375ea259eb239b122b7f7:/wxPython/demo/GenericButtons.py diff --git a/wxPython/demo/GenericButtons.py b/wxPython/demo/GenericButtons.py index 1e0ad0a146..7a08befcff 100644 --- a/wxPython/demo/GenericButtons.py +++ b/wxPython/demo/GenericButtons.py @@ -10,6 +10,7 @@ class TestPanel(wx.Panel): def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log + ##self.SetBackgroundColour("sky blue") sizer = wx.FlexGridSizer(1, 3, 20, 20) @@ -42,7 +43,7 @@ class TestPanel(wx.Panel): self.Bind(wx.EVT_BUTTON, self.OnBiggerButton, b) b.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False)) b.SetBezelWidth(5) - ###b.SetBestSize() + b.SetMinSize(wx.DefaultSize) b.SetBackgroundColour("Navy") b.SetForegroundColour(wx.WHITE) b.SetToolTipString("This is a BIG button...") @@ -67,14 +68,14 @@ class TestPanel(wx.Panel): b = buttons.GenBitmapButton(self, -1, None) self.Bind(wx.EVT_BUTTON, self.OnButton, b) bmp = images.getBulb1Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapLabel(bmp) bmp = images.getBulb2Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapSelected(bmp) - b.SetBestSize() + b.SetInitialSize() sizer.Add(b) # A toggle button @@ -86,32 +87,48 @@ class TestPanel(wx.Panel): b = buttons.GenBitmapToggleButton(self, -1, None) self.Bind(wx.EVT_BUTTON, self.OnToggleButton, b) bmp = images.getBulb1Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapLabel(bmp) bmp = images.getBulb2Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapSelected(bmp) b.SetToggle(True) - b.SetBestSize() + b.SetInitialSize() sizer.Add(b) # A bitmap button with text. b = buttons.GenBitmapTextButton(self, -1, None, "Bitmapped Text", size = (200, 45)) self.Bind(wx.EVT_BUTTON, self.OnButton, b) bmp = images.getBulb1Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapLabel(bmp) bmp = images.getBulb2Bitmap() - mask = wx.MaskColour(bmp, wx.BLUE) + mask = wx.Mask(bmp, wx.BLUE) bmp.SetMask(mask) b.SetBitmapSelected(bmp) b.SetUseFocusIndicator(False) - b.SetBestSize() + b.SetInitialSize() sizer.Add(b) + + # a flat text button + b = buttons.GenButton(self, -1, 'Flat buttons too!', style=wx.BORDER_NONE) + self.Bind(wx.EVT_BUTTON, self.OnButton, b) + sizer.Add(b, flag=wx.ALIGN_CENTER_VERTICAL) + + # A flat image button + bmp = images.getTest2Bitmap() + bmp.SetMaskColour("blue") + b = buttons.GenBitmapButton(self, -1, bmp, style=wx.BORDER_NONE) + self.Bind(wx.EVT_BUTTON, self.OnButton, b) + sizer.Add(b) + ##b.SetBackgroundColour("sky blue") + ##b.SetBackgroundColour("pink") + + border = wx.BoxSizer(wx.VERTICAL) border.Add(sizer, 0, wx.ALL, 25) self.SetSizer(border)