Example #1
0
def text_widget(master, ttip="", modal=False):
    t = Text(master)
    tooltip(t, ttip)
    if modal:
        a,b = pallet("DIALOG-BG"), pallet("DIALOG-FG")
    else:
        a,b = bg(), fg()
    t.config(background=a, foreground=b)
    return t
Example #2
0
def text_widget(master, ttip="", modal=False):
    t = Text(master)
    tooltip(t, ttip)
    if modal:
        a,b = pallet("DIALOG-BG"), pallet("DIALOG-FG")
    else:
        a,b = bg(), fg()
    t.config(background=a, foreground=b)
    return t
Example #3
0
def button(master, text, command=None, ttip=""):
    b = Button(master, text=text)
    if command:
        b.config(command=command)
    tooltip(b, ttip)
    b.config(background=pallet("button-bg"), foreground=pallet("button-fg"))
    b.config(activebackground=pallet("ACTIVE-BG"))
    b.config(activeforeground=pallet("ACTIVE-FG"))
    b.config(highlightbackground=bg())
    return b
Example #4
0
def button(master, text, command=None, ttip=""):
    b = Button(master, text=text)
    if command:
        b.config(command=command)
    tooltip(b, ttip)
    b.config(background=pallet("button-bg"), foreground=pallet("button-fg"))
    b.config(activebackground=pallet("ACTIVE-BG"))
    b.config(activeforeground=pallet("ACTIVE-FG"))
    b.config(highlightbackground=bg())
    return b
Example #5
0
def label(master, text, var=None, modal=False):
    w = Label(master, text=text)
    w.config(justify=LEFT)
    if var:
        w.config(textvariable=var)
    if modal:
        a, b = pallet("DIALOG-BG"), pallet("DIALOG-FG")
    else:
        a, b = bg(), fg()
    w.config(background=a, foreground=b)
    return w
Example #6
0
def radio(master, text, var, value, ttip="", modal=False, command=None):
    rb = Radiobutton(master, text=text, variable=var, value=value)
    tooltip(rb, ttip)
    if modal:
        rb.config(background=pallet("DIALOG-BG"))
        rb.config(foreground=pallet("DIALOG-FG"))
    else:
        rb.config(background=bg(), foreground=fg())
    rb.config(highlightbackground=bg())
    rb.config(selectcolor=pallet("radio-select"))
    rb.config(activebackground=pallet("active-bg"))
    rb.config(activeforeground=pallet("active-fg"))
    rb.config(command=command)
    return rb
Example #7
0
def radio(master, text, var, value, ttip="", modal=False, command=None):
    rb = Radiobutton(master, text=text, variable=var, value=value)
    tooltip(rb, ttip)
    if modal:
        rb.config(background=pallet("DIALOG-BG"))
        rb.config(foreground=pallet("DIALOG-FG"))
    else:
        rb.config(background=bg(), foreground=fg())
    rb.config(highlightbackground=bg())
    rb.config(selectcolor=pallet("radio-select"))
    rb.config(activebackground=pallet("active-bg"))
    rb.config(activeforeground=pallet("active-fg"))
    rb.config(command=command)
    return rb
Example #8
0
def checkbutton(master, text, var=None,
                command = None,
                ttip="", modal=False):
    cb = Checkbutton(master, text=text, variable=var)
    if modal:
        cb.config(background=pallet("DIALOG-BG"))
        cb.config(foreground=pallet("DIALOG-FG"))
    else:
        cb.config(background=bg(), foreground=fg())
    cb.config(highlightbackground=bg())
    cb.config(selectcolor=pallet("radio-select"))
    cb.config(activebackground=pallet("active-bg"))
    cb.config(activeforeground=pallet("active-fg"))
    cb.config(command = command)
    return cb
Example #9
0
def checkbutton(master, text, var=None,
                command = None,
                ttip="", modal=False):
    cb = Checkbutton(master, text=text, variable=var)
    if modal:
        cb.config(background=pallet("DIALOG-BG"))
        cb.config(foreground=pallet("DIALOG-FG"))
    else:
        cb.config(background=bg(), foreground=fg())
    cb.config(highlightbackground=bg())
    cb.config(selectcolor=pallet("radio-select"))
    cb.config(activebackground=pallet("active-bg"))
    cb.config(activeforeground=pallet("active-fg"))
    cb.config(command = command)
    return cb
Example #10
0
def frame(master, modal=False):
    f = Frame(master)
    if modal:
        f.config(background=pallet("DIALOG-BG"))
    else:
        f.config(background = bg())
    return f
Example #11
0
def frame(master, modal=False):
    f = Frame(master)
    if modal:
        f.config(background=pallet("DIALOG-BG"))
    else:
        f.config(background = bg())
    return f
Example #12
0
def scrollbar(master, xclient=None, yclient=None, orientation=VERTICAL):
    # if orientation == VERTICAL:
    #     cls = __widget_class_name("Vertical.TScrollbar")
    # else:
    #     cls = __widget_class_name("Horizontal.TScrollbar")
    # sb = Scrollbar(master, class_ = cls)
    sb = Scrollbar(master)
    sb.config(orient=orientation)
    if xclient:
        xclient.config(xscrollcommand=sb.set)
        sb.config(command = xclient.xview)
    if yclient:
        yclient.config(yscrollcommand=sb.set)
        sb.config(command = yclient.yview)
    sb.config(background=pallet("scrollbar-background"))
    sb.config(troughcolor=pallet("scrollbar-trough"))
    return sb
Example #13
0
def label_frame(master, text, modal=False):
    f = LabelFrame(master, text=text)
    if modal:
        f.config(background=pallet("DIALOG-BG"))
        f.config(foreground=fg())
    else:
        f.config(background=bg(), fg=fg())
    return f
Example #14
0
def label_frame(master, text, modal=False):
    f = LabelFrame(master, text=text)
    if modal:
        f.config(background=pallet("DIALOG-BG"))
        f.config(foreground=fg())
    else:
        f.config(background=bg(), fg=fg())
    return f
Example #15
0
def scrollbar(master, xclient=None, yclient=None, orientation=VERTICAL):
    # if orientation == VERTICAL:
    #     cls = __widget_class_name("Vertical.TScrollbar")
    # else:
    #     cls = __widget_class_name("Horizontal.TScrollbar")
    # sb = Scrollbar(master, class_ = cls)
    sb = Scrollbar(master)
    sb.config(orient=orientation)
    if xclient:
        xclient.config(xscrollcommand=sb.set)
        sb.config(command = xclient.xview)
    if yclient:
        yclient.config(yscrollcommand=sb.set)
        sb.config(command = yclient.yview)
    sb.config(background=pallet("scrollbar-background"))
    sb.config(troughcolor=pallet("scrollbar-trough"))
    return sb
Example #16
0
def scale(master, from_=200, to=0, command=None,
          orientation=VERTICAL, var=None,
          resolution = 1, ttip=""):
    s = Scale(master, from_=from_, to=to, orient=orientation,
              resolution = resolution)
    s.config(command=command)
    s.config(showvalue=False)
    s.config(width = 12)
    s.config(length = 150)
    s.config(sliderrelief="raised")
    s.config(sliderlength=20)
    s.config(borderwidth=0)
    s.config(troughcolor=pallet("slider-trough"))
    s.config(highlightthickness=1)  # 0 to hide trough
    s.config(highlightbackground=pallet("slider-outline"))
    tooltip(s, ttip)
    if var:
        s.configure(variable=var)
    return s
Example #17
0
def label(master, text, var=None, modal=False, justify=LEFT):
    '''
    Creates Tk label widget
    master - Tk container
    text  - 
    var - Optional Tk var 
    modal - flag, set True is this widget is for use in pop up dialog.
    justify - String, default LEFT
    '''
    w = Label(master, text=text)
    w.config(justify=justify)
    if var:
        w.config(textvariable=var)
    if modal:
        a, b = pallet("DIALOG-BG"), pallet("DIALOG-FG")
    else:
        a, b = bg(), fg()
    w.config(background=a, foreground=b)
    return w
Example #18
0
def scale(master, from_=200, to=0, command=None,
          orientation=VERTICAL, var=None,
          resolution = 1, ttip=""):
    s = Scale(master, from_=from_, to=to, orient=orientation,
              resolution = resolution)
    s.config(command=command)
    s.config(showvalue=False)
    s.config(width = 12)
    s.config(length = 150)
    s.config(sliderrelief="raised")
    s.config(sliderlength=20)
    s.config(borderwidth=0)
    s.config(troughcolor=pallet("slider-trough"))
    s.config(highlightthickness=1)  # 0 to hide trough
    s.config(highlightbackground=pallet("slider-outline"))
    tooltip(s, ttip)
    if var:
        s.configure(variable=var)
    return s
Example #19
0
def _init_theme():
    global _style
    try:
        if not _style:
            _style = Style()
            try:
                _style.theme_use("alt")
            except TclError:
                _style.theme_use("default")
            _style.theme_create("Llia", parent="alt", settings = {
                "TNotebook" : {"configure" : {"tabmargins" : [2,5,2,0]}},

                "TNotebook.Tab" : {"configure" : {"padding" : [5,1],
                                                  "background" : pallet("TAB-BG"),
                                                  "foreground" : pallet("TAB-FG")},
                                   "map" : {"background" : [("selected", pallet("TAB-SELECTED-BG"))],
                                            "foreground" : [("selected", pallet("TAB-SELECTED-FG"))],
                                            "expand" : [("selected", [1,1,1,0])] }}})
            _style.theme_use("Llia")
    except TclError:
        # Raised if Llia theme already exists
        pass  
Example #20
0
def _init_theme():
    global _style
    try:
        if not _style:
            _style = Style()
            try:
                _style.theme_use("alt")
            except TclError:
                _style.theme_use("default")
            _style.theme_create("Llia", parent="alt", settings = {
                "TNotebook" : {"configure" : {"tabmargins" : [2,5,2,0]}},

                "TNotebook.Tab" : {"configure" : {"padding" : [5,1],
                                                  "background" : pallet("TAB-BG"),
                                                  "foreground" : pallet("TAB-FG")},
                                   "map" : {"background" : [("selected", pallet("TAB-SELECTED-BG"))],
                                            "foreground" : [("selected", pallet("TAB-SELECTED-FG"))],
                                            "expand" : [("selected", [1,1,1,0])] }}})
            _style.theme_use("Llia")
    except TclError:
        # Raised if Llia theme already exists
        pass  
Example #21
0
def bg():
    return pallet("bg")
Example #22
0
def fg():
    return pallet("fg")
Example #23
0
def fg():
    return pallet("fg")
Example #24
0
def bg():
    return pallet("bg")
Example #25
0
def warning_label(master, text=" ", var=None, modal=True):
    w = label(master, text, var, modal)
    w.config(foreground=pallet("warning-fg"))
    return w
Example #26
0
def warning_label(master, text=" ", var=None, modal=True):
    w = label(master, text, var, modal)
    w.config(foreground=pallet("warning-fg"))
    return w