Exemplo n.º 1
0
    def __init__(self, master, max=None, items=None, min=0, step=1, format=None, title="", hint="",
            initialval=None, class_=None, *a, **kw):
        class_ = class_ or "TkRangeChooser"
        if items is not None:
            # using list of pairs to spinning
            initialval = [v for k,v in items if k==initialval]
            if initialval:
                initialval = initialval[0]
            self.items = collections.OrderedDict((unicode(v), unicode(k)) for k,v in items)
            self.v = StringVar()
            self.sb = dict(textvariable=self.v, values=self.items.keys())
        else:
            # else use numeric values to spinning
            if type(max) is float:
                self.v = DoubleVar()
            else:
                self.v = IntVar()
            self.sb = dict(textvariable=self.v, from_=min, to=max, increment=step, format=format)

        self._iv = initialval

        if hint:
            self._h = hint
        else:
            self._h = "Enter value from range:"
        Dialog.__init__(self, master, title=title, class_=class_, *a, **kw)
Exemplo n.º 2
0
 def __init__(self, master, text="", title="", hint="", class_=None, *a, **kw):
     class_ = class_ or "TkTextDialog"
     self._t = text
     if hint:
         self._h = hint
     else:
         self._h = "Edit text lines:"
     Dialog.__init__(self, master, title=title, class_=class_, *a, **kw)
Exemplo n.º 3
0
 def destroy(self):
     self.hint.unbind_all("<Configure>")
     if self.edttracename:
         self.edtvar.trace_vdelete('w', self.edttracename)
         self.edttracename = None
     self.edtvar = None
     self.validhintvar = None
     self.hint = None
     self.edtbtnimg = None
     Dialog.destroy(self)
Exemplo n.º 4
0
 def __init__(self, master, title="", headers=None, class_=None, *a, **kw):
     """headers is the pair, default is ('Name', 'Value')
     """
     class_ = class_ or "TkPropsDialog"
     if headers:
         self._h = headers
     else:
         self._h = ("Name", "Value")
     self.st = None # ScrolledText
     # modal is False to allow users to add properties with add_prop()
     Dialog.__init__(self, master, title=title, class_=class_, modal=False, *a, **kw)
     self.bind_all("<Configure>", self._onconfigure)
Exemplo n.º 5
0
 def __init__(self, master, items=(), title="", hint="", selectmode=Tix.SINGLE,
         initialsel=None, class_=None, *a, **kw):
     """items is list of pairs (key, value): key is returned when selected, value is
     shown in list, hint is the text under items list, selectmode is SINGLE or EXTENDED,
     initialsel is the string like 'a,b,c,d' (only keys of selected items)
     """
     class_ = class_ or "TkItemsChooser"
     self.items = collections.OrderedDict((unicode(k), unicode(v)) for k,v in items)
     self._sm = selectmode
     self._is = initialsel
     if hint:
         self._h = hint
     else:
         if selectmode in (Tix.SINGLE, Tix.BROWSE):
             self._h = "Select some item:"
         else:
             self._h = "Select one or more items:"
     Dialog.__init__(self, master, title=title, class_=class_, *a, **kw)
Exemplo n.º 6
0
 def destroy(self):
     self.unbind_all("<Return>")
     self.unbind_all("<Escape>")
     Dialog.destroy(self)
Exemplo n.º 7
0
 def __init__(self, master, dotcfgobj, title="", class_=None, *a, **kw):
     """dotcfgobj is DotCfg (parsed)
     """
     self.dotcfg = dotcfgobj
     class_ = class_ or "TkDotCfg"
     Dialog.__init__(self, master, title=title, class_=class_, *a, **kw)
Exemplo n.º 8
0
 def destroy(self):
     self.unbind_all("<Escape>")
     self.unbind_all("<Configure>")
     Dialog.destroy(self)
Exemplo n.º 9
0
 def __init__(self, master, authfunc=None, title="", class_=None, *a, **kw):
     """dotcfgobj is DotCfg (opened)
     """
     self.authfunc = authfunc or (lambda u,p: None)
     class_ = class_ or "TkPwdLogin"
     Dialog.__init__(self, master, title=title, class_=class_, *a, **kw)