示例#1
0
class WheelEntry(LabelFrame):
    DIA_UNITS = [dist.mm, dist.cm, dist.inch]

    def __init__(self, **kwargs):
        master = None if 'master' not in kwargs else kwargs['master']
        LabelFrame.__init__(self, master, text='Wheel')
        self.unitopts = ['%s (%s)' % (x.name, x.symbol)
                         for x in WheelEntry.DIA_UNITS]
        self.__val = WheelEntry.DIA_UNITS[0]
        self.createSpin()
        self.create_unit_opts()

    def create_unit_opts(self):
        self.unitoptselected = StringVar()
        self.unitoptselected.set(self.unitopts[2])
        self.unitopt = OptionMenu(self, self.unitoptselected, *self.unitopts)
        self.unitopt.grid(row=1, column=1, in_=self)
        self.val()

    def val(self, val=None):
        if val is not None:
            self.__val.value = val
        else:
            sel = self.unitoptselected.get().split()[0]
            for u in WheelEntry.DIA_UNITS:
                if sel in u.name:
                    self.__val = u
                    self.__val.value = int(self.Spin.val.get())
        return self.__val

    def createSpin(self):
        self.Spin = LabeledSpin(title='Dia')
        self.Spin.val.set(27)
        self.Spin.Spin.config(from_=10, to=1000, width=4)
        self.Spin.grid(row=1, column=0, in_=self)
示例#2
0
    def __init__(self, **kwargs):
        master = None if 'master' not in kwargs else kwargs['master']
        pos = -1 if 'pos' not in kwargs else kwargs['pos']

        LabeledSpin.__init__(self, master=master)
        self.__ringpos = pos
        self.Spin.config(from_=10, to=60, width=2)
        self.render()
示例#3
0
    def __init__(self, **kwargs):
        master = None if 'master' not in kwargs else kwargs['master']
        pos = -1 if 'pos' not in kwargs else kwargs['pos']

        LabeledSpin.__init__(self, master=master)
        self.__ringpos = pos
        self.Spin.config(from_=10, to=60, width=2)
        self.render()
示例#4
0
class WheelEntry(LabelFrame):
    DIA_UNITS = [dist.mm, dist.cm, dist.inch]

    def __init__(self, **kwargs):
        master = None if 'master' not in kwargs else kwargs['master']
        LabelFrame.__init__(self, master, text='Wheel')
        self.unitopts = [
            '%s (%s)' % (x.name, x.symbol) for x in WheelEntry.DIA_UNITS
        ]
        self.__val = WheelEntry.DIA_UNITS[0]
        self.createSpin()
        self.create_unit_opts()

    def create_unit_opts(self):
        self.unitoptselected = StringVar()
        self.unitoptselected.set(self.unitopts[2])
        self.unitopt = OptionMenu(self, self.unitoptselected, *self.unitopts)
        self.unitopt.grid(row=1, column=1, in_=self)
        self.val()

    def val(self, val=None):
        if val is not None:
            self.__val.value = val
        else:
            sel = self.unitoptselected.get().split()[0]
            for u in WheelEntry.DIA_UNITS:
                if sel in u.name:
                    self.__val = u
                    self.__val.value = int(self.Spin.val.get())
        return self.__val

    def createSpin(self):
        self.Spin = LabeledSpin(title='Dia')
        self.Spin.val.set(27)
        self.Spin.Spin.config(from_=10, to=1000, width=4)
        self.Spin.grid(row=1, column=0, in_=self)
示例#5
0
 def createSpin(self):
     self.Spin = LabeledSpin(title='Dia')
     self.Spin.val.set(27)
     self.Spin.Spin.config(from_=10, to=1000, width=4)
     self.Spin.grid(row=1, column=0, in_=self)
示例#6
0
 def createSpin(self):
     self.Spin = LabeledSpin(title='Dia')
     self.Spin.val.set(27)
     self.Spin.Spin.config(from_=10, to=1000, width=4)
     self.Spin.grid(row=1, column=0, in_=self)