| 236 | self._command() |
| 237 | |
| 238 | class Metro_Button(Button): |
| 239 | def __init__(self, master, text, background, ID=None, foreground="white", opacity=0.8, font=None, command=None, padx=7, pady=7): |
| 240 | opacity = float(opacity) |
| 241 | |
| 242 | if background.startswith("#"): |
| 243 | r,g,b = hex2rgb(background) |
| 244 | else: |
| 245 | # Color name |
| 246 | r,g,b = master.winfo_rgb(background) |
| 247 | |
| 248 | r = int(opacity*r) |
| 249 | g = int(opacity*g) |
| 250 | b = int(opacity*b) |
| 251 | |
| 252 | if r <= 255 and g <= 255 and b <=255: |
| 253 | activebackground = '#%02x%02x%02x' % (r,g,b) |
| 254 | else: |
| 255 | activebackground = '#%04x%04x%04x' % (r,g,b) |
| 256 | |
| 257 | |
| 258 | Button.__init__(self, master, ID=ID, text=text, activebackground=activebackground, background=background, activeforeground=foreground, foreground=foreground, relief=FLAT, padx=padx, pady=pady, borderwidth=0, highlightthickness=0) |
| 259 | if font: |
| 260 | self.configure(font=font) |
| 261 | |
| 262 | if command: |
| 263 | self.configure(command=command) |
| 264 | |
| 265 | class Metro_Entry(Frame): |
| 266 | BORDER_COLOR = "#999999" |
no outgoing calls
no test coverage detected