def test_sliderwidget_set(self):
        global inCB
        inCB = False
        def slider_cb(val):
            global inCB
            inCB = True
        global widget
        from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SliderWidget
        import Tkinter
        root = Tkinter.Toplevel()
        widget = SliderWidget(root, command=slider_cb)
        widget.pack()
        pause()
        widget.set(9.567, update=0)
        self.assertEqual(not inCB,True)
        val = widget.get()
        self.assertEqual(val == 9.567,True)
        widget.set(10.567, update=1)
        self.assertEqual(inCB,True)
        val = widget.get()
        self.assertEqual(val==10.567,True)
        # need to check if the cursorlabel has the proper format
        pause()
    


        widget.master.destroy()
    def test_sliderwidget_set(self):
        global inCB
        inCB = False

        def slider_cb(val):
            global inCB
            inCB = True

        global widget
        from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SliderWidget
        import Tkinter
        root = Tkinter.Toplevel()
        widget = SliderWidget(root, command=slider_cb)
        widget.pack()
        pause()
        widget.set(9.567, update=0)
        self.assertEqual(not inCB, True)
        val = widget.get()
        self.assertEqual(val == 9.567, True)
        widget.set(10.567, update=1)
        self.assertEqual(inCB, True)
        val = widget.get()
        self.assertEqual(val == 10.567, True)
        # need to check if the cursorlabel has the proper format
        pause()

        widget.master.destroy()
    def test_sliderwidget_discrete(self):
        global widget
        from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SliderWidget
        import Tkinter
        root = Tkinter.Toplevel()
        widget = SliderWidget(root,label='discrete slider',
                          labelsCursorFormat='%4d', immediate=0,
                          lookup=[10, 15, 25, 46, 78, 99] )
        widget.pack()
        # the widget min, max and val are indices in the lookup table.
        self.assertEqual(widget.min==0,True)
        pause()
        # set a non existent val the val must be the min.
        try:
            widget.set(9.567)
        except ValueError:
            val = widget.get()
            self.assertEqual(val == 10,True)

        pause()
        # set to a value in the lookup table. the widget.val must be the index of
        # this val.
        widget.set(78)
        val = widget.get()
        self.assertEqual(val == 78,True)
        self.assertEqual(widget.val == widget.lookup.index(78),True)
        pause()

        # set to a value greater than the last value of the look up table.
        try:
            widget.set(110)

        except ValueError:
            val = widget.get()
            self.assertEqual(val == 78,True)

        pause()

        # set the min value of the discrete slider
        widget.setMin(15)
        val = widget.get()
        self.assertEqual(val == 15,True)
        self.assertEqual(widget.min == 1,True)

        widget.set(10)
        val = widget.get()
        self.assertEqual(val == widget.lookup[widget.min],True)

        pval = widget.get()
        widget.setMax(78)
        val = widget.get()
        self.assertEqual(val == pval,True)
        self.assertEqual(widget.max == widget.lookup.index(78),True)
        widget.set(99)
        self.assertEqual(widget.get() == widget.lookup[widget.max],True)

        pause()

        widget.master.destroy()
    def test_sliderwidget_discrete(self):
        global widget
        from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SliderWidget
        import Tkinter
        root = Tkinter.Toplevel()
        widget = SliderWidget(root,
                              label='discrete slider',
                              labelsCursorFormat='%4d',
                              immediate=0,
                              lookup=[10, 15, 25, 46, 78, 99])
        widget.pack()
        # the widget min, max and val are indices in the lookup table.
        self.assertEqual(widget.min == 0, True)
        pause()
        # set a non existent val the val must be the min.
        try:
            widget.set(9.567)
        except ValueError:
            val = widget.get()
            self.assertEqual(val == 10, True)

        pause()
        # set to a value in the lookup table. the widget.val must be the index of
        # this val.
        widget.set(78)
        val = widget.get()
        self.assertEqual(val == 78, True)
        self.assertEqual(widget.val == widget.lookup.index(78), True)
        pause()

        # set to a value greater than the last value of the look up table.
        try:
            widget.set(110)

        except ValueError:
            val = widget.get()
            self.assertEqual(val == 78, True)

        pause()

        # set the min value of the discrete slider
        widget.setMin(15)
        val = widget.get()
        self.assertEqual(val == 15, True)
        self.assertEqual(widget.min == 1, True)

        widget.set(10)
        val = widget.get()
        self.assertEqual(val == widget.lookup[widget.min], True)

        pval = widget.get()
        widget.setMax(78)
        val = widget.get()
        self.assertEqual(val == pval, True)
        self.assertEqual(widget.max == widget.lookup.index(78), True)
        widget.set(99)
        self.assertEqual(widget.get() == widget.lookup[widget.max], True)

        pause()

        widget.master.destroy()