Welcome, guest | Sign In | My Account | Store | Cart
# Author: Miguel Martinez Lopez
# Version: 0.4

try:
    import Tkinter as tk
    import ttk

    from Tkinter import StringVar
    import tkFont

    from ttk import Style
    from Tkconstants import *
except ImportError:
    import tkinter as tk
    import tkinter.ttk as ttk

    from tkinter import StringVar
    import tkinter.font as tkFont
    from tkinter.ttk import Style
    from tkinter.constants import *
    
import base64

import weakref

# Support for Python 3
try:
    xrange
except NameError:
    xrange = range

try:
  basestring
except NameError:
  basestring = str


class NotValidID(Exception):
    """Not a valid ID widget"""

_registered_widgets =  weakref.WeakValueDictionary()

def get_widget_by_ID(ID):
    if ID in _registered_widgets:
        return _registered_widgets[ID]
    else:
        raise NotValidID
    
def get_background_of_widget(widget):
    try:
        # We assume first tk widget
        background = widget.cget("background")
    except:
        # Otherwise this is a ttk widget
        style = widget.cget("style")

        if style == "":
            # if there is not style configuration option, default style is the same than widget class
            style = widget.winfo_class()

        background = Style().lookup(style, 'background')
    
    return background

def hex2rgb(str_rgb):
    try:
        rgb = str_rgb[1:]

        if len(rgb) == 6:
            r, g, b = rgb[0:2], rgb[2:4], rgb[4:6]
        elif len(rgb) == 3:
            r, g, b = rgb[0] * 2, rgb[1] * 2, rgb[2] * 2
        else:
            raise ValueError()
    except:
        raise ValueError("Invalid value %r provided for rgb color."% str_rgb)

    return tuple(int(v, 16) for v in (r, g, b))
    

class Placeholder_State(object):
     __slots__ = 'normal_color', 'normal_font', 'placeholder_text', 'placeholder_color', 'placeholder_font', 'contains_placeholder'

def add_placeholder_to(entry, placeholder, color="grey", font=None):
    normal_color = entry.cget("fg")
    normal_font = entry.cget("font")
    
    if font is None:
        font = normal_font

    state = Placeholder_State()
    state.normal_color=normal_color
    state.normal_font=normal_font
    state.placeholder_color=color
    state.placeholder_font=font
    state.placeholder_text = placeholder
    state.contains_placeholder=True

    def on_focusin(event, entry=entry, state=state):
        if state.contains_placeholder:
            entry.delete(0, "end")
            entry.config(fg = state.normal_color, font=state.normal_font)
        
            state.contains_placeholder = False

    def on_focusout(event, entry=entry, state=state):
        if entry.get() == '':
            entry.insert(0, state.placeholder_text)
            entry.config(fg = state.placeholder_color, font=state.placeholder_font)
            
            state.contains_placeholder = True

    entry.insert(0, placeholder)
    entry.config(fg = color, font=font)

    entry.bind('<FocusIn>', on_focusin, add="+")
    entry.bind('<FocusOut>', on_focusout, add="+")
    
    entry.placeholder_state = state

    return state


class MetroWidget(object):
    """Inherits background from parent and adds ID to widget"""
    def __init__(self, widget_class, master, ID, kwargs, inherit_background=True):
        if inherit_background:
            if "background" in kwargs:
                if kwargs["background"] is None:
                    kwargs["background"] = get_background_of_widget(master)
                    self.inherited_background = True
                else:
                    self.inherited_background = False
            elif "bg" in kwargs:
                if kwargs["bg"] is None:
                    kwargs["bg"] = get_background_of_widget(master)
                    self.inherited_background = True
                else:
                    self.inherited_background = False
            else:
                kwargs["background"] = get_background_of_widget(master)
                self.inherited_background = True

        widget_class.__init__(self, master, **kwargs)
        
        if ID is not None:
            global _registered_widgets
            if ID in _registered_widgets:
                raise Exception("ID already taken: %s"%ID)

            _registered_widgets[ID] = self

        self._ID = ID
        
    def ID(self):
        return self._ID

class Combobox(ttk.Combobox, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, ttk.Combobox, master, ID, kwargs, False)

class PanedWindow(tk.PanedWindow, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.PanedWindow, master, ID, kwargs)

class Entry(tk.Entry, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Entry, master, ID, kwargs, False)

class Button(tk.Button, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Button, master, ID, kwargs, False)

class Frame(tk.Frame, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Frame, master, ID, kwargs)

class LabelFrame(tk.LabelFrame, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.LabelFrame, master, ID, kwargs)

class Label(tk.Label, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Label, master, ID, kwargs)

class Radiobutton(tk.Radiobutton, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Radiobutton, master, ID, kwargs)

class Checkbutton(tk.Checkbutton, MetroWidget):
    def __init__(self, master, ID=None, **kwargs):
        MetroWidget.__init__(self, tk.Checkbutton, master, ID, kwargs)


class Metro_ButtonLabel(Label):
    def __init__(self, master, text, background, ID=None, foreground="white", opacity=0.8, font=None, command=None, padx=7, pady=7):
        Label.__init__(self, master, ID=ID, text=text, background=background, foreground=foreground, padx=padx, pady=pady)
        if font:
            self.configure(font=font)

        opacity = float(opacity)

        if background.startswith("#"):
            r,g,b = hex2rgb(background)
        else:
            # Color name
            r,g,b = master.winfo_rgb(background)

        r = int(opacity*r)
        g = int(opacity*g)
        b = int(opacity*b)

        if r <= 255 and g <= 255 and b <=255:
            self._activebackground = '#%02x%02x%02x' % (r,g,b)
        else:
            self._activebackground = '#%04x%04x%04x' % (r,g,b)

        self._background = background
        
        self.bind("<Enter>", self._state_active)
        self.bind("<Leave>", self._state_normal)
        
        self._command = command

        if command is not None:
            self.bind("<ButtonRelease-1>", command)

    def _state_normal(self, event):
        self.configure(background=self._background)

    def _state_active(self, event):
        self.configure(background=self._activebackground)

    def invoke(self):
        if self._command is not None:
            self._command()

class Metro_Button(Button):
    def __init__(self, master, text, background, ID=None, foreground="white", opacity=0.8, font=None, command=None, padx=7, pady=7):
        opacity = float(opacity)

        if background.startswith("#"):
            r,g,b = hex2rgb(background)
        else:
            # Color name
            r,g,b = master.winfo_rgb(background)

        r = int(opacity*r)
        g = int(opacity*g)
        b = int(opacity*b)

        if r <= 255 and g <= 255 and b <=255:
            activebackground = '#%02x%02x%02x' % (r,g,b)
        else:
            activebackground = '#%04x%04x%04x' % (r,g,b)


        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)
        if font:
            self.configure(font=font)

        if command:
            self.configure(command=command)

class Metro_Entry(Frame):
    BORDER_COLOR = "#999999"
    ACTIVE_BORDERCOLOR = "#787878"

    BACKGROUND = "white"

    DISABLED_BACKGROUND = "#EBEBE4"
    DISABLED_FOREGROUND = "#545454"
    
    BORDER_WIDTH = 1

    def __init__(self, master, width=None, placeholder=None, placeholder_font=None, placeholder_color="grey", highlightthickness= 1, state=NORMAL, font=None, ID=None):

        Frame.__init__(self, master, ID=ID, bd=0, background=Metro_Entry.BACKGROUND, highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)
        
        self._entry = Entry(self, background=Metro_Entry.BACKGROUND, disabledbackground=Metro_Entry.DISABLED_BACKGROUND , disabledforeground=Metro_Entry.DISABLED_FOREGROUND, highlightthickness=0, bd=0)
        self._entry.pack(expand=True, fill=BOTH, padx=5, pady=5)

        if placeholder:
            add_placeholder_to(self._entry, placeholder, color=placeholder_color, font=placeholder_font)

        if font:
            self._entry.configure(font=font)

        if width:
            self._entry.configure(width=width)

        self._highlightthickness = highlightthickness

        self._entry.bind("<Escape>", lambda event: self._entry.nametowidget(".").focus())

        self._entry.bind('<FocusIn>', self._on_focusin, add="+")
        self._entry.bind('<FocusOut>', self._on_focusout, add="+")
        
        self.delete = self._entry.delete
        self.get = self._entry.get
        self.icursor = self._entry.icursor
        self.insert = self._entry.insert
        self.insert = self._entry.insert
        self.scan_dragto = self._entry.scan_dragto
        self.scan_dragto = self._entry.scan_dragto
        self.scan_mark = self._entry.scan_mark
        self.select_adjust = self._entry.select_adjust
        self.select_clear = self._entry.select_clear
        self.select_from = self._entry.select_from
        self.select_present = self._entry.select_present
        self.select_range = self._entry.select_range
        self.select_to = self._entry.select_to
        self.selection_adjust = self._entry.selection_adjust
        self.selection_clear = self._entry.selection_clear
        self.selection_from = self._entry.selection_from
        self.selection_present = self._entry.selection_present
        self.selection_range = self._entry.selection_range
        self.selection_range = self._entry.selection_range
        self.selection_to = self._entry.selection_to
        self.xview = self._entry.xview
        self.xview_moveto = self._entry.xview_moveto
        self.xview_scroll = self._entry.xview_scroll

    def _on_focusin(self, event):
        if self._highlightthickness == 0:
            self.configure(highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)
        else:
            self.configure(highlightbackground=Metro_Entry.ACTIVE_BORDERCOLOR, highlightcolor=Metro_Entry.ACTIVE_BORDERCOLOR, highlightthickness=self._highlightthickness)

    def _on_focusout(self, event):
        self.configure(highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)

    def get_state(self):
        return sel._entry.cget("state")

    def set_state(self, state):
        if state == NORMAL:
             self.configure(background="white")
        else: 
            self.configure(background=Metro_Entry.DISABLED_BACKGROUND)

        self._entry.configure(state=state)

    def get_font(self):
        return sel._entry.cget("font")

    def set_font(self, font):
        self._entry.configure(font=font)

    def bind_entry(self, event, handler):
        self._entry.bind(event, handler)

class Search_Box(Frame):
    def __init__(self, master, button_text="Search", button_ipadx=16, button_background="#009688", button_foreground="white", button_font=None, opacity=0.8, placeholder=None, placeholder_font=None, placeholder_color="grey", entry_highlightthickness=1, entry_width=30, entry_font=None, command=None, ID=None):
        Frame.__init__(self, master, ID=ID)
        
        self._command = command

        self.entry = Metro_Entry(self, width=entry_width, placeholder=placeholder, placeholder_font=placeholder_font, placeholder_color=placeholder_color, highlightthickness=entry_highlightthickness)
        self.entry.pack(side=LEFT, fill=BOTH)

        if entry_font:
            self.entry.configure(font=entry_font)
            
        self.button = Metro_Button(self, text=button_text, background=button_background, foreground=button_foreground, font=button_font, command=self._execute_command, padx=button_ipadx)
        self.button.pack(side=LEFT, fill=Y)

        if command is not None:
            self.entry.bind_entry("<Return>", lambda event: self.button.invoke())

    def get_text(self):
        entry = self.entry
        if hasattr(entry, "placeholder_state"):
            if entry.placeholder_state.contains_placeholder:
                return ""
            else:
                return entry.get()
        else:
            return entry.get()
        
    def set_text(self, text):
        entry = self.entry
        if hasattr(entry, "placeholder_state"):
            entry.placeholder_state.contains_placeholder = False

        entry.delete(0, END)
        entry.insert(0, text)
        
    def clear(self):
        self.entry_var.set("")
        
    def focus(self):
        self.entry.focus()

    def _execute_command(self):
        text = self.get_text()
        self._command(text)


class Base_Container(object):
    @property
    def background(self):
        return self.cget("background")

    def set_background(self, background, cascade=True):
        self.configure(background=background)

        if not cascade:
            return

        list_of_widgets = list(form_widget.children.values())
        
        while True:
            try:
                widget = list_of_widgets.pop()
            except IndexError:
                break

            list_of_widgets.extend(list(widget.children.values()))
            
            if hasattr(widget, "inherited") and not widget.inherited:
                continue
            
            try:
                widget.configure(background=background)
            except:
                pass

class Container(Frame, Base_Container):
    def __init__(self, master, **kwargs):
        kwargs.setdefault("class_", "Container")
        Frame.__init__(self, master, **kwargs)

class Label_Container(LabelFrame, Base_Container):
    def __init__(self, master, **kwargs):
        kwargs.setdefault("class_", "Label_Container")
        LabelFrame.__init__(self, master, **kwargs)

class Link_Button(Label):
    def __init__(self, master, text, background=None, font=None, familiy=None, size=None, underline=True, visited_fg = "#551A8B", normal_fg = "#0000EE", visited=False, action=None, ID=None):
        self._visited_fg = visited_fg
        self._normal_fg = normal_fg
        
        if visited:
            fg = self._visited_fg
        else:
            fg = self._normal_fg

        if font is None:
            default_font = tkFont.nametofont("TkDefaultFont")
            family = default_font.cget("family")

            if size is None:
                size = default_font.cget("size")

            font = tkFont.Font(family=family, size=size, underline=underline)

        Label.__init__(self, master, ID=ID, background=background, text=text, fg=fg, cursor="hand2", font=font)

        self._visited = visited
        self._action = action

        self.bind("<Button-1>", self._on_click)

    @property
    def visited(self):
        return self._visited
        
    @visited.setter
    def visited(self, is_visited):
        if is_visited:
            self.configure(fg=self._visited_fg)
            self._visited = True
        else:
            self.configure(fg=self._normal_fg)
            self._visited = False

    def _on_click(self, event):
        if not self._visited:
            self.configure(fg=self._visited_fg)

        self._visited = True

        if self._action:
            self._action()

    def ID(self):
        return self._ID

class QuoteFrame(Frame):
    CONTENT_BACKGROUND = "#eeeeee"
    CONTENT_PADDING = 10
    LEFT_BORDER_COLOR = "#555555"
    LEFT_BORDER_WIDTH = 6

    def __init__(self,master=None, text=None, ID=None):
        Frame.__init__(self, master, ID=ID, background = self.CONTENT_BACKGROUND)
        Frame(self, background=self.LEFT_BORDER_COLOR, width=self.LEFT_BORDER_WIDTH).pack(side=LEFT, fill=Y)
    
        self.body = Container(self, background = self.CONTENT_BACKGROUND, padx=self.CONTENT_PADDING, pady=self.CONTENT_PADDING)
        self.body.pack(expand=True, fill=BOTH)
        
        if text is not None:
            Label(self.body, text=text).pack(anchor=W)

class Metro_LabelFrame(Frame):
    HEADER_BACKGROUND = "#1ba1e2"
    HEADER_FOREGROUND = "white"
    CONTENT_BACKGROUND = "#e8f1f4"
    INNER_PADDING = 8
    
    FONT_HEADER = "TkDefaultFont"
    #("Segoe UI", "Open Sans", "sans-serif", "serif")

    def __init__(self, master, title, ID=None):
        Frame.__init__(self, master, ID=ID)
        
        header = tk.Frame(self, background=self.HEADER_BACKGROUND, padx=self.INNER_PADDING, pady= self.INNER_PADDING)
        header.pack(fill=X)
        
        self._title = title
        self._title_label = tk.Label(header, text=title, foreground=self.HEADER_FOREGROUND, background=self.HEADER_BACKGROUND, font=self.FONT_HEADER)
        self._title_label.pack(anchor=W)
        
        self.body = Container(self, padx=self.INNER_PADDING, pady= self.INNER_PADDING, background = self.CONTENT_BACKGROUND)
        self.body.pack(expand=True, fill=BOTH)
        
    @property
    def title(self):
        return self._title

    @title.setter
    def title(self, title):
        self._title = title
        self._title_label.configure(text=title)


class Metro_Panel(Frame):
    def __init__(self, master, title, header_color, border_color, width=None, ID=None):
        Frame.__init__(self, master, ID=ID, highlightbackground=border_color, highlightcolor=border_color, highlightthickness=1, background="white")
        heading = tk.Frame(self, background=header_color)
        heading.pack(fill=X)
                
        title_label = tk.Label(heading, text=title, foreground="white", background=header_color)
        title_label.pack(padx=8, pady=1, anchor=W)
        
        if width is not None:
            heading.pack_propagate(False)
            heading.configure(width=width, height=title_label.winfo_reqheight()+2)
        
        self.body = Container(self, background="white", padx=10, pady=13)
        self.body.pack(expand=True, fill=BOTH)

class Primary_Panel(Metro_Panel):
    def __init__(self, master, title, width=None):
        Metro_Panel.__init__(self, master, title, "#2780e3", "#2780e3", width)

class Danger_Panel(Metro_Panel):
    def __init__(self, master, title, width=None):
        Metro_Panel.__init__(self, master, title, "#ff0039", "#f0005e", width)

class Success_Panel(Metro_Panel):
    def __init__(self, master, title, width=None):
        Metro_Panel.__init__(self, master, title, "#3fb618", "#4e9f15", width)

class Info_Panel(Metro_Panel):
    def __init__(self, master, title, width=None):
        Metro_Panel.__init__(self, master, title, "#9954bb", "#7643a8", width)

class Warning_Panel(Metro_Panel):
    def __init__(self, master, title, width=None):
        Metro_Panel.__init__(self, master, title, "#ff7518", "#ff4309", width)

class Metro_Checkbutton(tk.Checkbutton):
    image = { 
        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZmYsMHhmZiwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLAoweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwKMHhmZiwweGZmCn07',
        22: 'I2RlZmluZSBpbWFnZV93aWR0aCAyMgojZGVmaW5lIGltYWdlX2hlaWdodCAyMgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7C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}

    def __init__(self, master, size=22, **kw):
        image = Metro_Checkbutton.image[size]
        
        if isinstance(image, basestring):
            Metro_Checkbutton.image[size] = image = tk.BitmapImage(data=base64.b64decode(image))

        selectimage = Metro_Checkbutton.selectimage[size]
        
        if isinstance(selectimage, basestring):
            Metro_Checkbutton.selectimage[size] = selectimage = tk.BitmapImage(data=base64.b64decode(selectimage))

        background = get_background_of_widget(master)
        tk.Checkbutton.__init__(self, master, indicatoron=0, background=background, activebackground="white", selectimage=selectimage, image=image, highlightthickness=0, **kw)

class Metro_Radiobutton(tk.Radiobutton):
    image = {
        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZTAsMHgwNywweGY4LDB4MWYsMHgzYywweDNjLDB4MGUsMHg3MCwweDA2LDB4NjAsMHgwNywweGUwLDB4MDMsMHhjMCwweDAzLAoweGMwLDB4MDMsMHhjMCwweDAzLDB4YzAsMHgwNywweGUwLDB4MDYsMHg2MCwweDBlLDB4NzAsMHgzYywweDNjLDB4ZjgsMHgxZiwKMHhlMCwweDA3Cn07',
        22: 'I2RlZmluZSBpbWFnZV93aWR0aCAyMgojZGVmaW5lIGltYWdlX2hlaWdodCAyMgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgzZiwweDAwLDB4ZTAsMHhmZiwweDAxLDB4ZjAsMHhmZiwweDAzLDB4ZjgsMHhjMCwweDA3LDB4M2MsMHgwMCwweDBmLAoweDFlLDB4MDAsMHgxZSwweDBlLDB4MDAsMHgxYywweDBlLDB4MDAsMHgxYywweDA3LDB4MDAsMHgzOCwweDA3LDB4MDAsMHgzOCwKMHgwNywweDAwLDB4MzgsMHgwNywweDAwLDB4MzgsMHgwNywweDAwLDB4MzgsMHgwNywweDAwLDB4MzgsMHgwZiwweDAwLDB4MWMsCjB4MGUsMHgwMCwweDFjLDB4MWUsMHgwM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hmZiwweDAwLDB4ZmMsMHg3ZiwweDAwLDB4ZmYsMHhmZiwweDAwLDB4ZmUsCjB4N2UsMHgwMCwweGZlLDB4N2YsMHgwMCwweDdlLDB4N2UsMHgwMCwweGZjLDB4M2YsMHgwMCwweDdlLDB4ZmUsMHgwMCwweGY4LAoweDFmLDB4MDAsMHg3ZiwweGZlLDB4MDAsMHhlMCwweDA3LDB4MDAsMHg3ZiwweGZjLDB4MDEsMHgwMCwweDAwLDB4ODAsMHgzZiwKMHhmYywweDAxLDB4MDAsMHgwMCwweDgwLDB4M2YsMHhmOCwweDAzLDB4MDAsMHgwMCwweGMwLDB4MWYsMHhmOCwweDA3LDB4MDAsCjB4MDAsMHhlMCwweDFmLDB4ZjAsMHgwZiwweDAwLDB4MDAsMHhmMCwweDBmLDB4ZTAsMHgxZiwweDAwLDB4MDAsMHhmOCwweDA3LAoweGMwLDB4N2YsMHgwMCwweDAwLDB4ZmUsMHgwMywweDgwLDB4ZmYsMHgwMSwweDgwLDB4ZmYsMHgwMSwweDAwLDB4ZmYsMHgwZiwKMHhmMCwweGZmLDB4MDAsMHgwMCwweGZlLDB4ZmYsMHhmZiwweDdmLDB4MDAsMHgwMCwweGZjLDB4ZmYsMHhmZiwweDNmLDB4MDAsCjB4MDAsMHhmOCwweGZmLDB4ZmYsMHgxZiwweDAwLDB4MDAsMHhlMCwweGZmLDB4ZmYsMHgwNywweDAwLDB4MDAsMHg4MCwweGZmLAoweGZmLDB4MDEsMHgwMAp9Ow=='
    }

    def __init__(self, master, size=22, **kw):
        image = Metro_Radiobutton.image[size]
        
        if isinstance(image, basestring):
            Metro_Radiobutton.image[size] = image = tk.BitmapImage(data=base64.b64decode(image))

        selectimage = Metro_Radiobutton.selectimage[size]
        
        if isinstance(selectimage, basestring):
            Metro_Radiobutton.selectimage[size] = selectimage = tk.BitmapImage(data=base64.b64decode(selectimage))

        background = get_background_of_widget(master)
        tk.Radiobutton.__init__(self, master, indicatoron=0, background=background, selectcolor=background, activebackground=background, selectimage=selectimage, image=image, highlightthickness=0, borderwidth=0, **kw)

def initialize_font():
    if "Open Sans" in tkFont.families():
        default_font = tkFont.nametofont("TkDefaultFont")
        default_font.configure(family="Open Sans", size=11)
        
        default_font = tkFont.nametofont("TkTextFont")
        default_font.configure(family="Open Sans", size=11)

if __name__ == "__main__":
    
    try:
        from Tkinter import Tk
        from tkMessageBox import showinfo
    except ImportError:
        from tkinter import Tk
        from tkinter.messagebox import showinfo
        
    root = Tk()
    
    initialize_font()

    page = Container(root, bg="white", bd=1, relief=RIDGE, padx=10, pady=10)
    page.pack()

    row = Frame(page)
    row.pack()

    metro_labelframe = Metro_LabelFrame(row, title="This is the title")
    metro_labelframe.pack(side=LEFT, padx=6, pady=9)
    for i  in range(5):
        Label(metro_labelframe.body, text="This is line number %i"%i).pack(expand=True, fill=BOTH)

    metro_labelframe = Metro_LabelFrame(row, title="This is the title")
    metro_labelframe.pack(side=LEFT, padx=6, pady=9)
    
    Label(metro_labelframe.body, text="One line").pack(anchor=W)
    Label(metro_labelframe.body, text="Another line").pack(anchor=W)
    Label(metro_labelframe.body, text="more lines...").pack(anchor=W)
    quote = QuoteFrame(metro_labelframe.body, text="blah.. blah..blah..blah..blah..blah..")
    quote.pack()

    Label(metro_labelframe.body, text="more body here...").pack(anchor=W)
    
    def callback():
        import webbrowser
        webbrowser.open_new(r"http://www.google.com")

    link = Link_Button(row, text="Google Hyperlink", action=callback)
    link.pack(padx=10, pady=10)
    
    row = Frame(page)
    row.pack()

    metro_panel = Primary_Panel(row, "Primary Panel", width=250)
    metro_panel.pack(padx=10, pady=7, side=LEFT)
    Label(metro_panel.body, text="Panel content").pack(anchor=W)

    metro_panel = Info_Panel(row, "Info Panel", width=250)
    metro_panel.pack(padx=10, pady=7, side=LEFT)
    Label(metro_panel.body, text="Panel content").pack(anchor=W)

    metro_panel = Danger_Panel(row, "Danger Panel", width=300)
    metro_panel.pack(padx=10, pady=7, side=LEFT)
    Label(metro_panel.body, text="Panel content").pack(anchor=W)

    metro_panel = Success_Panel(row, "Success Panel", width=250)
    metro_panel.pack(padx=10, pady=7, side=LEFT)
    Label(metro_panel.body, text="Panel content").pack(anchor=W)

    metro_panel = Warning_Panel(row, "Warning Panel", width=250)
    metro_panel.pack(padx=10, pady=7)
    Label(metro_panel.body, text="Panel content").pack(anchor=W)
    
    row = Frame(page)
    row.pack(pady=4, fill=X)

    Label(row, text="Metro button:").pack(side=LEFT)
    Metro_Button(row, "Search", "#60a917").pack(side=LEFT, padx=4)
    Metro_Button(row, "Run", "red").pack(side=LEFT, padx=4)
    Metro_Button(row, "Login", "#8b5a2b").pack(side=LEFT, padx=4)
    
    row = Frame(page)
    row.pack(pady=4, fill=X)

    def command(text):
        showinfo("search command", "searching:%s"%text)

    searchbox = Search_Box(page, command=command, placeholder="Type and press enter", entry_highlightthickness=0)
    searchbox.pack(anchor=W)
    
    row = Frame(page)
    row.pack(pady=4, fill=X)

    Metro_Checkbutton(row).pack(side=LEFT)
    Label(row, text="option1").pack(padx=(2,0), side=LEFT)

    var = StringVar()

    row = Frame(page)
    row.pack(pady=4, fill=X)

    Metro_Radiobutton(row,variable=var, value="0").pack(side=LEFT)
    Label(row, text="option2").pack(padx=(2,0),side=LEFT)
    Metro_Radiobutton(row,variable=var, value="1").pack(side=LEFT, padx=(10,0))
    Label(row, text="option3").pack(padx=(2,0), side=LEFT)

    Label(page, text="This is an entry:").pack(anchor=W)
    Metro_Entry(page).pack(anchor=W)
    root.mainloop()

Diff to Previous Revision

--- revision 19 2017-04-10 14:28:49
+++ revision 20 2017-04-13 23:48:27
@@ -1,12 +1,13 @@
 # Author: Miguel Martinez Lopez
-# Version: 0.3
+# Version: 0.4
 
 try:
     import Tkinter as tk
     import ttk
 
     from Tkinter import StringVar
-    from tkFont import Font, nametofont
+    import tkFont
+
     from ttk import Style
     from Tkconstants import *
 except ImportError:
@@ -14,9 +15,11 @@
     import tkinter.ttk as ttk
 
     from tkinter import StringVar
-    from tkinter.font import Font, nametofont
+    import tkinter.font as tkFont
     from tkinter.ttk import Style
     from tkinter.constants import *
+    
+import base64
 
 import weakref
 
@@ -25,6 +28,12 @@
     xrange
 except NameError:
     xrange = range
+
+try:
+  basestring
+except NameError:
+  basestring = str
+
 
 class NotValidID(Exception):
     """Not a valid ID widget"""
@@ -253,18 +262,102 @@
         if command:
             self.configure(command=command)
 
-class SearchBox(Frame):
-    def __init__(self, master, entry_width=30, entry_font=None, entry_background="white", entry_highlightthickness=1, button_text="Search", button_ipadx=28, button_background="#009688", button_foreground="white", button_font=None, opacity=0.8, placeholder=None, placeholder_font=None, placeholder_color="grey", spacing=4, command=None, ID=None):
+class Metro_Entry(Frame):
+    BORDER_COLOR = "#999999"
+    ACTIVE_BORDERCOLOR = "#787878"
+
+    BACKGROUND = "white"
+
+    DISABLED_BACKGROUND = "#EBEBE4"
+    DISABLED_FOREGROUND = "#545454"
+    
+    BORDER_WIDTH = 1
+
+    def __init__(self, master, width=None, placeholder=None, placeholder_font=None, placeholder_color="grey", highlightthickness= 1, state=NORMAL, font=None, ID=None):
+
+        Frame.__init__(self, master, ID=ID, bd=0, background=Metro_Entry.BACKGROUND, highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)
+        
+        self._entry = Entry(self, background=Metro_Entry.BACKGROUND, disabledbackground=Metro_Entry.DISABLED_BACKGROUND , disabledforeground=Metro_Entry.DISABLED_FOREGROUND, highlightthickness=0, bd=0)
+        self._entry.pack(expand=True, fill=BOTH, padx=5, pady=5)
+
+        if placeholder:
+            add_placeholder_to(self._entry, placeholder, color=placeholder_color, font=placeholder_font)
+
+        if font:
+            self._entry.configure(font=font)
+
+        if width:
+            self._entry.configure(width=width)
+
+        self._highlightthickness = highlightthickness
+
+        self._entry.bind("<Escape>", lambda event: self._entry.nametowidget(".").focus())
+
+        self._entry.bind('<FocusIn>', self._on_focusin, add="+")
+        self._entry.bind('<FocusOut>', self._on_focusout, add="+")
+        
+        self.delete = self._entry.delete
+        self.get = self._entry.get
+        self.icursor = self._entry.icursor
+        self.insert = self._entry.insert
+        self.insert = self._entry.insert
+        self.scan_dragto = self._entry.scan_dragto
+        self.scan_dragto = self._entry.scan_dragto
+        self.scan_mark = self._entry.scan_mark
+        self.select_adjust = self._entry.select_adjust
+        self.select_clear = self._entry.select_clear
+        self.select_from = self._entry.select_from
+        self.select_present = self._entry.select_present
+        self.select_range = self._entry.select_range
+        self.select_to = self._entry.select_to
+        self.selection_adjust = self._entry.selection_adjust
+        self.selection_clear = self._entry.selection_clear
+        self.selection_from = self._entry.selection_from
+        self.selection_present = self._entry.selection_present
+        self.selection_range = self._entry.selection_range
+        self.selection_range = self._entry.selection_range
+        self.selection_to = self._entry.selection_to
+        self.xview = self._entry.xview
+        self.xview_moveto = self._entry.xview_moveto
+        self.xview_scroll = self._entry.xview_scroll
+
+    def _on_focusin(self, event):
+        if self._highlightthickness == 0:
+            self.configure(highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)
+        else:
+            self.configure(highlightbackground=Metro_Entry.ACTIVE_BORDERCOLOR, highlightcolor=Metro_Entry.ACTIVE_BORDERCOLOR, highlightthickness=self._highlightthickness)
+
+    def _on_focusout(self, event):
+        self.configure(highlightbackground=Metro_Entry.BORDER_COLOR, highlightcolor=Metro_Entry.BORDER_COLOR, highlightthickness=Metro_Entry.BORDER_WIDTH)
+
+    def get_state(self):
+        return sel._entry.cget("state")
+
+    def set_state(self, state):
+        if state == NORMAL:
+             self.configure(background="white")
+        else: 
+            self.configure(background=Metro_Entry.DISABLED_BACKGROUND)
+
+        self._entry.configure(state=state)
+
+    def get_font(self):
+        return sel._entry.cget("font")
+
+    def set_font(self, font):
+        self._entry.configure(font=font)
+
+    def bind_entry(self, event, handler):
+        self._entry.bind(event, handler)
+
+class Search_Box(Frame):
+    def __init__(self, master, button_text="Search", button_ipadx=16, button_background="#009688", button_foreground="white", button_font=None, opacity=0.8, placeholder=None, placeholder_font=None, placeholder_color="grey", entry_highlightthickness=1, entry_width=30, entry_font=None, command=None, ID=None):
         Frame.__init__(self, master, ID=ID)
         
         self._command = command
 
-        self.entry = tk.Entry(self, width=entry_width, background=entry_background, highlightcolor=button_background, highlightthickness=entry_highlightthickness)
-        self.entry.pack(side=LEFT, fill=BOTH, ipady=1, padx=(0,spacing))
-        if placeholder:
-            add_placeholder_to(self.entry, placeholder, color=placeholder_color, font=placeholder_font)
-
-        self.entry.bind("<Escape>", lambda event: self.entry.nametowidget(".").focus())
+        self.entry = Metro_Entry(self, width=entry_width, placeholder=placeholder, placeholder_font=placeholder_font, placeholder_color=placeholder_color, highlightthickness=entry_highlightthickness)
+        self.entry.pack(side=LEFT, fill=BOTH)
 
         if entry_font:
             self.entry.configure(font=entry_font)
@@ -273,7 +366,7 @@
         self.button.pack(side=LEFT, fill=Y)
 
         if command is not None:
-            self.entry.bind("<Return>", lambda event: self.button.invoke())
+            self.entry.bind_entry("<Return>", lambda event: self.button.invoke())
 
     def get_text(self):
         entry = self.entry
@@ -354,13 +447,13 @@
             fg = self._normal_fg
 
         if font is None:
-            default_font = nametofont("TkDefaultFont")
+            default_font = tkFont.nametofont("TkDefaultFont")
             family = default_font.cget("family")
 
             if size is None:
                 size = default_font.cget("size")
 
-            font = Font(family=family, size=size, underline=underline)
+            font = tkFont.Font(family=family, size=size, underline=underline)
 
         Label.__init__(self, master, ID=ID, background=background, text=text, fg=fg, cursor="hand2", font=font)
 
@@ -455,7 +548,7 @@
             heading.pack_propagate(False)
             heading.configure(width=width, height=title_label.winfo_reqheight()+2)
         
-        self.body = Container(self, background="white", padx=15, pady=15)
+        self.body = Container(self, background="white", padx=10, pady=13)
         self.body.pack(expand=True, fill=BOTH)
 
 class Primary_Panel(Metro_Panel):
@@ -478,500 +571,75 @@
     def __init__(self, master, title, width=None):
         Metro_Panel.__init__(self, master, title, "#ff7518", "#ff4309", width)
 
-# Page label states
-NOT_SELECTED = 0
-SELECTED = 1
-
-NORMAL = 0
-ACTIVE = 1
-
-
-class PageLabel(tk.Label, object):
-    def __init__(self, master, is_selected, is_active, is_displayed=True, **kwargs):
-        tk.Label.__init__(self, master, **kwargs)
-        
-        self._page_number = int(kwargs["text"])
-        
-        self.is_selected = is_selected
-        self.is_active = is_active
-        
-        self.is_displayed = is_displayed
-
-    @property
-    def page_number(self):
-        return self._page_number
-        
-    @page_number.setter
-    def page_number(self, value):
-        self._page_number = value
-        self.configure(text=value)
-
-class Pagination(Frame):
-
-    def __init__(self, master, displayed_pages, total_pages, ID=None, background=None, current_page=None, start_page=1, prev_button= "Prev", next_button="Next", first_button="First", last_button="Last", hide_at_edge=False, command =None, pagination_style=None):
-        if pagination_style is None:
-            raise Exception("No pagination style defined")
-        
-        self._start_page = start_page
-        self._end_page = min(total_pages, start_page + displayed_pages - 1)
-
-        if current_page is None:
-            current_page = start_page
-        else:
-            if not self._start_page <= current_page <= self._end_page:
-                raise ValueError("Not valid selected page")
-
-        Frame.__init__(self, master, ID=None, background=background)
-
-        self._command = command
-        
-        self._hide_at_edge = hide_at_edge
-
-        self._list_of_page_labels = []
-
-        self._total_pages = total_pages        
-        self._displayed_pages = displayed_pages
-
-        self._left_controls = None
-        self._right_controls = None
-
-        self._previous_label = None
-        self._first_label = None        
-        self._next_label = None
-        self._last_label = None
-
-        self._current_page = current_page
-        
-        self._pagination_style = pagination_style
-
-        self._render_pagination(current_page, prev_button, next_button, first_button, last_button)
-
-    def _render_pagination(self, current_page, prev_button, next_button, first_button, last_button):
-        if self._hide_at_edge:
-            if self._start_page == 1:
-                self._are_left_controls_displayed = False
-            else:
-                self._are_left_controls_displayed 
-
-            if self._end_page == self._total_pages:
-                self._are_right_controls_displayed = False
-            else:
-                self._are_right_controls_displayed = True
-        else:
-            self._are_left_controls_displayed = True
-            self._are_right_controls_displayed = True
-
-        button_spacing = self._pagination_style.get("button_spacing", 0)
-        
-        if first_button is None:
-            if prev_button is not None:
-                self._left_controls = tk.Frame(self)
-                self._left_controls.pack(side=LEFT, padx=(0, button_spacing))
-                
-                self._previous_label = self._navigation_control(self._left_controls, "prev", prev_button)
-                self._previous_label.pack(side=LEFT)
-        else:
-            self._left_controls = tk.Frame(self)
-            if self._are_left_controls_displayed:
-                self._left_controls.pack(side=LEFT, padx=(0, button_spacing))
-            
-            self._first_label = self._navigation_control(self._left_controls, "first", first_button)
-            self._first_label.pack(side=LEFT)
-
-            if prev_button is not None:
-                self._previous_label = self._navigation_control(self._left_controls, "prev", prev_button)
-                self._previous_label.pack(side=LEFT, padx=(button_spacing,0))
-
-        self._page_frame = tk.Frame(self)
-        self._page_frame.pack(side=LEFT)
-        
-        first_page = True
-        for page_number in range(self._start_page,self._start_page + self._displayed_pages):
-            is_selected = (page_number == self._current_page)
-
-            if page_number <= self._end_page:
-                page_label = self._page_label(page_number, is_selected)
-
-                if first_page:
-                    first_page = False
-                    page_label.pack(side=LEFT)
-                else:
-                    page_label.pack(side=LEFT, padx=(button_spacing, 0))
-                    
-            else:
-                page_label = self._page_label(page_number, is_selected, False)
-            self._list_of_page_labels.append(page_label)
-
-        if last_button is None:
-            if prev_button is not None:
-                self._right_controls = tk.Frame(self)
-                self._right_controls.pack(side=LEFT, padx=(button_spacing, 0))
-                
-                self._next_label = self._navigation_control(self._right_controls, "next", next_button)               
-                self._next_label.pack(side=RIGHT)
-
-        else:
-            self._right_controls = tk.Frame(self)
-            if self._are_right_controls_displayed:
-                self._right_controls.pack(side=LEFT, padx=(button_spacing, 0))
-
-            self._last_label = self._navigation_control(self._right_controls, "last", last_button)
-            self._last_label.pack(side=RIGHT)
-
-            if next_button is not None:
-                self._next_label = self._navigation_control(self._right_controls, "next", next_button)
-                self._next_label.pack(side=RIGHT, padx=(0,button_spacing))
-
-    def _update_labels(self):
-
-        if self._hide_at_edge:
-            button_spacing = self._pagination_style.get("button_spacing", 0)
-
-            if self._start_page == 1:
-                if self._are_left_controls_displayed:
-                    self._are_left_controls_displayed = False
-                    self._left_controls.pack_forget()
-            else:
-                if not self._are_left_controls_displayed:
-                    self._are_left_controls_displayed = True
-                    self._left_controls.pack(side=LEFT, padx=(0, button_spacing), before=self._page_frame)
-
-            if self._end_page == self._total_pages:
-                if self._are_right_controls_displayed:
-                    self._are_right_controls_displayed = False
-                    self._right_controls.pack_forget()
-            else:                
-                if not self._are_right_controls_displayed:
-                    self._are_right_controls_displayed = True
-                    self._right_controls.pack(side=LEFT, padx=(button_spacing, 0), after=self._page_frame)
-
-        first_page_label = True
-        for i, page_number in enumerate(xrange(self._start_page, self._end_page+1)):
-            page_label = self._list_of_page_labels[i]
-            
-            if self._current_page == page_number:
-                if not page_label.is_selected:
-                    self._config_style(page_label, SELECTED, NORMAL)
-                    page_label.is_selected = True
-            else:
-                if page_label.is_selected:
-                    self._config_style(page_label, NOT_SELECTED, NORMAL)
-                    page_label.is_selected = False
-            
-            if not page_label.is_displayed:
-                page_label.is_displayed = True
-                
-                if first_page_label:
-                    page_label.pack(side=LEFT)
-                else:
-                    page_label.pack(side=LEFT, padx=(button_spacing, 0))
-
-            page_label.page_number = page_number
-            first_page_label = False
-
-        for i in range(self._end_page-self._start_page+1, self._displayed_pages):
-            page_label = self._list_of_page_labels[i]
-            
-            if page_label.is_displayed:
-                page_label.pack_forget()
-                page_label.is_displayed = False
-    
-    def _navigation_control(self, master, control_name, text):
-        onclick_control = getattr(self, "%s_page"%control_name)
-        
-        label = tk.Label(master, text=text, width=0)
-        
-        self._config_style(label, NOT_SELECTED, NORMAL)
-        label.bind("<1>", lambda event: onclick_control())
-        
-        label.bind("<Enter>", lambda event, label=label: self._config_style(label, NOT_SELECTED, ACTIVE))
-        label.bind("<Leave>", lambda event, label=label: self._config_style(label, NOT_SELECTED, NORMAL))
-
-        return label
-
-    def _page_label(self, page_number, is_selected):
-        label = PageLabel(self._page_frame, text=page_number, is_selected=is_selected, is_active=False, width=0)
-        
-        if is_selected:
-            self._config_style(label, SELECTED, NORMAL)
-        else:
-            self._config_style(label, NOT_SELECTED, NORMAL)
-
-        label.bind("<1>", lambda event, label=label: self._on_click_page(label))
-        
-        label.bind("<Enter>", lambda event, label=label: self._on_mouse_enter_page(label))
-        label.bind("<Leave>", lambda event, label=label: self._on_mouse_leave_page(label))
-
-        return label
-
-    def _on_mouse_enter_page(self, label):
-        label.is_active = True
-
-        if label.is_selected:
-            self._config_style(label, SELECTED, ACTIVE)
-        else:
-            self._config_style(label, NOT_SELECTED, ACTIVE)
-
-    def _on_mouse_leave_page(self, label):
-        label.is_active = False
-        if label.is_selected:
-            self._config_style(label, SELECTED, NORMAL)
-        else:
-            self._config_style(label, NOT_SELECTED, NORMAL)
-
-    def _on_click_page(self, new_page):
-        if new_page.page_number == self._current_page:
-            return
-
-        old_page = self._list_of_page_labels[self._current_page - self._start_page]
-        old_page.is_selected = False
-        self._config_style(old_page, NOT_SELECTED, NORMAL)
-
-        new_page.is_selected = True
-
-        self._current_page = new_page.page_number
-        self._config_style(new_page, SELECTED, ACTIVE)
-
-        if self._command is not None:
-            self._command(self._current_page)
-
-    def _config_style(self, label, selected_style, active_style):
-        font = self._pagination_style.get("font")
-        button_padx = self._pagination_style.get("button_padx")
-        button_pady = self._pagination_style.get("button_pady")
-
-        if selected_style == SELECTED:
-            style_config = self._pagination_style["selected_button"]
-        else:
-            style_config = self._pagination_style["normal_button"]
-            
-        config = {}
-        
-        if active_style == ACTIVE:
-            if "activebackground" in style_config:
-                config["background"] = style_config["activebackground"]
-            if "activeforeground" in style_config:
-                config["foreground"] = style_config["activeforeground"]
-        else:
-            if "background" in style_config:
-                config["background"] = style_config["background"]
-            if "foreground" in style_config:
-                config["foreground"] = style_config["foreground"]
-
-        if "padx" in style_config:
-            config["padx"] = style_config["padx"]
-        else:
-            if button_padx is not None:
-                config["padx"] = button_padx
-
-        if "pady" in style_config:
-            config["pady"] = style_config["pady"]
-        else:
-            if button_pady is not None:
-                config["pady"] = button_pady
-        
-        if "font" in style_config:
-            config["font"] = style_config["font"]
-        else:
-            if font is not None:
-                config["font"] = font
-
-        label.configure(**config)
-
-    def select_page(self, page_number, start_page=None):
-        self._current_page = page_number
-        if start_page is None:
-            if page_number < self._start_page:
-                self._start_page = page_number
-                self._end_page = self._start_page + self._displayed_pages - 1
-        else:
-            end_page = start_page + self._displayed_pages - 1
-
-            if not start_page <= page_number <= end_page:
-                raise ValueError("Page_number not visible")
-                
-            self._start_page = start_page
-            self._end_page = end_page
-            
-        self._update_labels()
-
-    def prev_page(self):
-        if self._current_page == 1: return
-
-        if self._current_page == self._start_page:
-            self._start_page -= 1
-            self._end_page -= 1
-
-        self._current_page -= 1
-        
-        if self._command is not None:
-            self._command(self._current_page)
-
-        self._update_labels()
-        
-    def next_page(self):
-        if self._current_page == self._total_pages: return
-
-        if self._current_page == self._end_page:
-            self._start_page += 1
-            self._end_page += 1
-            
-        self._current_page += 1
-        
-        if self._command is not None:
-            self._command(self._current_page)
-
-        self._update_labels()
-        
-    def first_page(self):
-        if self._current_page == 1: return
-
-        self._start_page = 1
-        self._end_page = min(self._total_pages, self._displayed_pages)
-        
-        self._current_page = 1
-        
-        if self._command is not None:
-            self._command(self._current_page)
-        
-        self._update_labels()
-        
-    def last_page(self):
-        if self._current_page == self._total_pages: return
-
-        self._end_page = self._total_pages
-        self._start_page = max(self._end_page- self._displayed_pages + 1, 1)
-
-        self._current_page = self._total_pages
-        
-        if self._command is not None:
-            self._command(self._current_page)
-
-        self._update_labels()
-
-    @property
-    def current_page(self):
-        return self._current_page
-    
-    page = current_page
-
-    @property
-    def total_pages(self):
-        return self._total_pages
-
-    def update(self, total_pages, current_page, start_page=1):
-        end_page = min(total_pages, start_page + self._displayed_pages - 1)
-
-        if not start_page <= current_page <= end_page:
-                raise ValueError("Not valid selected page")
-
-        self._start_page = start_page
-        self._end_page = end_page
-        
-        self._total_pages = total_pages
-        self._current_page = current_page
-
-        self._update_labels()
-    
-pagination_style1 = {
-    "button_spacing": 3,
-    "button_padx":12,
-    "button_pady": 6,
-    "normal_button": {
-        "font": ("Verdana", 10),
-        "foreground": "#337ab7", 
-        "activeforeground":"#23527c",
-        "background": "white",
-        "activebackground": "#eee"
-    }, 
-    "selected_button": {
-        "font":("Verdana", 10, "bold"),
-        "foreground":"#fff",
-        "activeforeground":"#fff", 
-        "background":"#337ab7", 
-        "activebackground":"#337ab7"
+class Metro_Checkbutton(tk.Checkbutton):
+    image = { 
+        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZmYsMHhmZiwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLAoweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwKMHhmZiwweGZmCn07',
+        22: 'I2RlZmluZSBpbWFnZV93aWR0aCAyMgojZGVmaW5lIGltYWdlX2hlaWdodCAyMgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgwMCwweDAwLDB4ZmYsMHhmZiwweDNmLDB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLAoweDAxLDB4MDAsMHgyMCwweDAxLDB4MDAsMHgyMCwweDAxLDB4MDAsMHgyMCwweDAxLDB4MDAsMHgyMCwweDAxLDB4MDAsMHgyMCwKMHgwMSwweDAwLDB4MjAsMHgwMSwweDAwLDB4MjAsMHgwMSwweDAwLDB4MjAsMHgwMSwweDAwLDB4MjAsMHgwMSwweDAwLDB4MjAsCjB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLDB4MDEsMHgwMCwweDIwLAoweDAxLDB4MDAsMHgyMCwweDAxLDB4MDAsMHgyMA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MCwweDAwLDB4MDAsMHgwMCwweGUwLDB4MDcsMHgwMCwweDAwLDB4MDAsMHgwMCwweGUwLAoweDA3LDB4MDAsMHgwMCwweDAwLDB4MDAsMHhlMCwweDA3LDB4MDAsMHgwMCwweDAwLDB4MDAsMHhlMCwweDA3LDB4MDAsMHgwMCwKMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4MDAsMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4MDAsMHgwMCwweDAwLDB4ZTAsCjB4MDcsMHgwMCwweDAwLDB4MDAsMHgwMCwweGUwLDB4ZmYsMHhmZiwweGZmLDB4ZmYsMHhmZiwweGZmLDB4ZmYsMHhmZiwweGZmLAoweGZmLDB4ZmYsMHhmZgp9Ow=='
     }
-}
-
-pagination_style2 = {
-    "button_spacing": 3,
-    "button_padx":12,
-    "button_pady":6,
-    "normal_button": {
-        "font": ("Verdana", 10),
-        "foreground": "black", 
-        "activeforeground":"black",
-        "background": "white", 
-        "activebackground": "#ccc"
-    }, 
-    "selected_button": {
-        "font":("Verdana", 10, "bold"),
-        "foreground":"white",
-        "activeforeground":"#fff", 
-        "background":"#f44336", 
-        "activebackground":"#f44336"
+
+    selectimage = {   
+        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZmYsMHhmZiwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwweDAxLDB4OTgsMHgwMSwweGJjLDB4MTksMHg5ZSwweDNkLAoweDhmLDB4ZjksMHg4NywweGYxLDB4ODMsMHhlMSwweDgxLDB4YzEsMHg4MCwweDAxLDB4ODAsMHgwMSwweDgwLDB4MDEsMHg4MCwKMHhmZiwweGZmCn07',
+        22: 'I2RlZmluZSBpbWFnZV93aWR0aCAyMgojZGVmaW5lIGltYWdlX2hlaWdodCAyMgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10g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wweDA3LDB4ZmMsMHhmZiwKMHhmZiwweDAwLDB4ZTAsMHgwNywweGY4LDB4ZmYsMHg3ZiwweDAwLDB4ZTAsMHgwNywweGYwLDB4ZmYsMHgzZiwweDAwLDB4ZTAsCjB4MDcsMHhlMCwweGZmLDB4MWYsMHgwMCwweGUwLDB4MDcsMHhjMCwweGZmLDB4MGYsMHgwMCwweGUwLDB4MDcsMHg4MCwweGZmLAoweDA3LDB4MDAsMHhlMCwweDA3LDB4MDAsMHhmZiwweDAzLDB4MDAsMHhlMCwweDA3LDB4MDAsMHhmZSwweDAxLDB4MDAsMHhlMCwKMHgwNywweDAwLDB4ZmMsMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4NzgsMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4MzAsCjB4MDAsMHgwMCwweGUwLDB4MDcsMHgwMCwweDAwLDB4MDAsMHgwMCwweGUwLDB4MDcsMHgwMCwweDAwLDB4MDAsMHgwMCwweGUwLAoweDA3LDB4MDAsMHgwMCwweDAwLDB4MDAsMHhlMCwweDA3LDB4MDAsMHgwMCwweDAwLDB4MDAsMHhlMCwweDA3LDB4MDAsMHgwMCwKMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4MDAsMHgwMCwweDAwLDB4ZTAsMHgwNywweDAwLDB4MDAsMHgwMCwweDAwLDB4ZTAsCjB4MDcsMHgwMCwweDAwLDB4MDAsMHgwMCwweGUwLDB4ZmYsMHhmZiwweGZmLDB4ZmYsMHhmZiwweGZmLDB4ZmYsMHhmZiwweGZmLAoweGZmLDB4ZmYsMHhmZgp9Ow=='
     }
-}
-
-pagination_style3 = {
-    "button_spacing": 3,
-    "button_padx":12,
-    "button_pady":6,
-    "normal_button": {
-        "font": ("Verdana", 10),
-        "foreground": "#717171", 
-        "activeforeground":"#717171",
-        "background": "#e9e9e9", 
-        "activebackground": "#fefefe"
-    }, 
-    "selected_button": {
-        "font":("Verdana", 10, "bold"),
-        "foreground":"#f0f0f0",
-        "activeforeground":"#f0f0f0", 
-        "background":"#616161", 
-        "activebackground":"#616161"
+
+    def __init__(self, master, size=22, **kw):
+        image = Metro_Checkbutton.image[size]
+        
+        if isinstance(image, basestring):
+            Metro_Checkbutton.image[size] = image = tk.BitmapImage(data=base64.b64decode(image))
+
+        selectimage = Metro_Checkbutton.selectimage[size]
+        
+        if isinstance(selectimage, basestring):
+            Metro_Checkbutton.selectimage[size] = selectimage = tk.BitmapImage(data=base64.b64decode(selectimage))
+
+        background = get_background_of_widget(master)
+        tk.Checkbutton.__init__(self, master, indicatoron=0, background=background, activebackground="white", selectimage=selectimage, image=image, highlightthickness=0, **kw)
+
+class Metro_Radiobutton(tk.Radiobutton):
+    image = {
+        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZTAsMHgwNywweGY4LDB4MWYsMHgzYywweDNjLDB4MGUsMHg3MCwweDA2LDB4NjAsMHgwNywweGUwLDB4MDMsMHhjMCwweDAzLAoweGMwLDB4MDMsMHhjMCwweDAzLDB4YzAsMHgwNywweGUwLDB4MDYsMHg2MCwweDBlLDB4NzAsMHgzYywweDNjLDB4ZjgsMHgxZiwKMHhlMCwweDA3Cn07',
+        22: 'I2RlZmluZSBpbWFnZV93aWR0aCAyMgojZGVmaW5lIGltYWdlX2hlaWdodCAyMgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgzZiwweDAwLDB4ZTAsMHhmZiwweDAxLDB4ZjAsMHhmZiwweDAzLDB4ZjgsMHhjMCwweDA3LDB4M2MsMHgwMCwweDBmLAoweDFlLDB4MDAsMHgxZSwweDBlLDB4MDAsMHgxYywweDBlLDB4MDAsMHgxYywweDA3LDB4MDAsMHgzOCwweDA3LDB4MDAsMHgzOCwKMHgwNywweDAwLDB4MzgsMHgwNywweDAwLDB4MzgsMHgwNywweDAwLDB4MzgsMHgw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wweGZlLDB4MDAsMHgwMCwweDAwLDB4MDAsMHg3ZiwweGZjLDB4MDEsMHgwMCwweDAwLDB4ODAsMHgzZiwKMHhmYywweDAxLDB4MDAsMHgwMCwweDgwLDB4M2YsMHhmOCwweDAzLDB4MDAsMHgwMCwweGMwLDB4MWYsMHhmOCwweDA3LDB4MDAsCjB4MDAsMHhlMCwweDFmLDB4ZjAsMHgwZiwweDAwLDB4MDAsMHhmMCwweDBmLDB4ZTAsMHgxZiwweDAwLDB4MDAsMHhmOCwweDA3LAoweGMwLDB4N2YsMHgwMCwweDAwLDB4ZmUsMHgwMywweDgwLDB4ZmYsMHgwMSwweDgwLDB4ZmYsMHgwMSwweDAwLDB4ZmYsMHgwZiwKMHhmMCwweGZmLDB4MDAsMHgwMCwweGZlLDB4ZmYsMHhmZiwweDdmLDB4MDAsMHgwMCwweGZjLDB4ZmYsMHhmZiwweDNmLDB4MDAsCjB4MDAsMHhmOCwweGZmLDB4ZmYsMHgxZiwweDAwLDB4MDAsMHhlMCwweGZmLDB4ZmYsMHgwNywweDAwLDB4MDAsMHg4MCwweGZmLAoweGZmLDB4MDEsMHgwMAp9Ow=='
     }
-}
-
-pagination_style4 = {
-    "button_spacing": 3,
-    "button_padx":12,
-    "button_pady":6,
-    "normal_button": {
-        "font": ("Verdana", 10),
-        "foreground": "#feffff", 
-        "activeforeground":"#feffff",
-        "background": "#3e4347", 
-        "activebackground": "#3d4f5d"
-    }, 
-    "selected_button": {
-        "font":("Verdana", 10, "bold"),
-        "foreground":"#feffff",
-        "activeforeground":"#feffff", 
-        "background":"#2f3237", 
-        "activebackground":"#2f3237"
+
+    selectimage = {
+        16: 'I2RlZmluZSBpbWFnZV93aWR0aCAxNgojZGVmaW5lIGltYWdlX2hlaWdodCAxNgpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4ZTAsMHgwNywweGY4LDB4MWYsMHgzYywweDNjLDB4MGUsMHg3MCwweDA2LDB4NjAsMHhjNywweGUzLDB4Z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YsMHgwNywweDAwLDB4MDAsMHg4MCwweGZmLAoweGZmLDB4MDEsMHgwMAp9Ow=='
     }
-}
-
-pagination_style5 = {
-    "button_spacing": 3,
-    "button_padx":12,
-    "button_pady":6,
-    "normal_button": {
-        "font": ("Verdana", 10),
-        "foreground": "#2E4057", 
-        "activeforeground":"#2E4057",
-        "background": "white", 
-        "activebackground": "white"
-    }, 
-    "selected_button": {
-        "font":("Verdana", 10, "bold"),
-        "foreground":"white",
-        "activeforeground":"white", 
-        "background":"#64a281", 
-        "activebackground":"#64a281"
-    }
-}
+
+    def __init__(self, master, size=22, **kw):
+        image = Metro_Radiobutton.image[size]
+        
+        if isinstance(image, basestring):
+            Metro_Radiobutton.image[size] = image = tk.BitmapImage(data=base64.b64decode(image))
+
+        selectimage = Metro_Radiobutton.selectimage[size]
+        
+        if isinstance(selectimage, basestring):
+            Metro_Radiobutton.selectimage[size] = selectimage = tk.BitmapImage(data=base64.b64decode(selectimage))
+
+        background = get_background_of_widget(master)
+        tk.Radiobutton.__init__(self, master, indicatoron=0, background=background, selectcolor=background, activebackground=background, selectimage=selectimage, image=image, highlightthickness=0, borderwidth=0, **kw)
+
+def initialize_font():
+    if "Open Sans" in tkFont.families():
+        default_font = tkFont.nametofont("TkDefaultFont")
+        default_font.configure(family="Open Sans", size=11)
+        
+        default_font = tkFont.nametofont("TkTextFont")
+        default_font.configure(family="Open Sans", size=11)
 
 if __name__ == "__main__":
     
@@ -983,22 +651,21 @@
         from tkinter.messagebox import showinfo
         
     root = Tk()
-
-    page = tk.Frame()
+    
+    initialize_font()
+
+    page = Container(root, bg="white", bd=1, relief=RIDGE, padx=10, pady=10)
     page.pack()
-    
-    main_container = Container(page, bg="white", bd=1, relief=RIDGE)
-    main_container.pack()
-    
-    container1 = Container(main_container)
-    container1.pack()
-
-    metro_labelframe = Metro_LabelFrame(container1, title="This is the title")
+
+    row = Frame(page)
+    row.pack()
+
+    metro_labelframe = Metro_LabelFrame(row, title="This is the title")
     metro_labelframe.pack(side=LEFT, padx=6, pady=9)
     for i  in range(5):
         Label(metro_labelframe.body, text="This is line number %i"%i).pack(expand=True, fill=BOTH)
 
-    metro_labelframe = Metro_LabelFrame(container1, title="This is the title")
+    metro_labelframe = Metro_LabelFrame(row, title="This is the title")
     metro_labelframe.pack(side=LEFT, padx=6, pady=9)
     
     Label(metro_labelframe.body, text="One line").pack(anchor=W)
@@ -1013,10 +680,10 @@
         import webbrowser
         webbrowser.open_new(r"http://www.google.com")
 
-    link = Link_Button(container1, text="Google Hyperlink", action=callback)
+    link = Link_Button(row, text="Google Hyperlink", action=callback)
     link.pack(padx=10, pady=10)
     
-    row = Frame(main_container)
+    row = Frame(page)
     row.pack()
 
     metro_panel = Primary_Panel(row, "Primary Panel", width=250)
@@ -1039,45 +706,39 @@
     metro_panel.pack(padx=10, pady=7)
     Label(metro_panel.body, text="Panel content").pack(anchor=W)
     
-    row = tk.Frame(page)
-    row.pack(padx=10, pady=4, fill=X)
-
-    tk.Label(row, text="Metro button:").pack(side=LEFT)
-    Metro_Button(row, "Search", "#60a917").pack(side=LEFT, padx=(0,4))
+    row = Frame(page)
+    row.pack(pady=4, fill=X)
+
+    Label(row, text="Metro button:").pack(side=LEFT)
+    Metro_Button(row, "Search", "#60a917").pack(side=LEFT, padx=4)
     Metro_Button(row, "Run", "red").pack(side=LEFT, padx=4)
     Metro_Button(row, "Login", "#8b5a2b").pack(side=LEFT, padx=4)
     
-    row = tk.Frame(page)
-    row.pack(padx=10, pady=4, fill=X)
+    row = Frame(page)
+    row.pack(pady=4, fill=X)
 
     def command(text):
         showinfo("search command", "searching:%s"%text)
 
-    searchbox = SearchBox(page, command=command, placeholder="Type and press enter", entry_highlightthickness=0)
-    searchbox.pack(padx=4, anchor=W)
-
-    def print_page(page_number):
-        print("page number %s"%page_number)
-
-    row = tk.Frame(page)
-    row.pack(padx=10, pady=4, fill=X)
-
-    tk.Label(row, text="Pagination").pack(anchor=W)
-    
-    pagination = Pagination(row, 5, 100, command=print_page, pagination_style=pagination_style1)
-    pagination.pack(pady=10, anchor=W)
-
-    pagination = Pagination(row, 5, 100, command=print_page, pagination_style=pagination_style2)
-    pagination.pack(pady=10, anchor=W)
-
-    pagination = Pagination(row, 5, 50, command=print_page,  pagination_style=pagination_style3)
-    pagination.pack(pady=10, anchor=W)
-
-    pagination = Pagination(row, 5, 100, command=print_page, pagination_style=pagination_style4)
-    pagination.pack(pady=10, anchor=W)
-
-    pagination = Pagination(row, 5, 100, command=print_page, pagination_style=pagination_style5)
-    pagination.pack(pady=10, anchor=W)
-    
-    
+    searchbox = Search_Box(page, command=command, placeholder="Type and press enter", entry_highlightthickness=0)
+    searchbox.pack(anchor=W)
+    
+    row = Frame(page)
+    row.pack(pady=4, fill=X)
+
+    Metro_Checkbutton(row).pack(side=LEFT)
+    Label(row, text="option1").pack(padx=(2,0), side=LEFT)
+
+    var = StringVar()
+
+    row = Frame(page)
+    row.pack(pady=4, fill=X)
+
+    Metro_Radiobutton(row,variable=var, value="0").pack(side=LEFT)
+    Label(row, text="option2").pack(padx=(2,0),side=LEFT)
+    Metro_Radiobutton(row,variable=var, value="1").pack(side=LEFT, padx=(10,0))
+    Label(row, text="option3").pack(padx=(2,0), side=LEFT)
+
+    Label(page, text="This is an entry:").pack(anchor=W)
+    Metro_Entry(page).pack(anchor=W)
     root.mainloop()

History