Robot Framework Integrated Development Environment (RIDE)
button.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import wx
17 from wx import Colour
18 
19 class ButtonWithHandler(wx.Button):
20 
21  def __init__(self, parent, label, handler=None, width=-1,
22  height=25, color_secondary_foreground='black', color_secondary_background='light grey'):
23  wx.Button.__init__(self, parent, label=label,
24  size=(width, height))
25  self.SetBackgroundColour(Colour(color_secondary_background))
26  self.SetOwnBackgroundColour(Colour(color_secondary_background))
27  self.SetForegroundColour(Colour(color_secondary_foreground))
28  self.SetOwnForegroundColour(Colour(color_secondary_foreground))
29  if not handler:
30  handler = getattr(parent, 'On'+label.replace(' ', ''))
31  parent.Bind(wx.EVT_BUTTON, handler, self)
def __init__(self, parent, label, handler=None, width=-1, height=25, color_secondary_foreground='black', color_secondary_background='light grey')
Definition: button.py:22