Example #1
0
 def test_colorsquare_bindings(self):
     cs = tkc.ColorSquare(self.window, hue=0, height=200, width=200)
     cs.pack()
     self.window.update()
     event = TestEvent(x=0, y=0)
     cs._on_click(event)
     self.assertEqual(cs.get(), ((0, 0, 0), (0, 100, 0), '#000000'))
     event.x = cs.winfo_width()
     cs._on_move(event)
     self.assertEqual(cs.get(), ((255, 0, 0), (0, 100, 100), '#FF0000'))
Example #2
0
 def test_colorsquare_functions(self):
     cs = tkc.ColorSquare(self.window, hue=60, height=200, width=200)
     cs.pack()
     self.window.update()
     cs._fill()
     self.window.update()
     cs._draw((60, 100, 100))
     self.window.update()
     self.assertEqual(cs.get_hue(), 60)
     self.window.update()
     cs.set_hue(40)
     self.assertEqual(cs.get_hue(), 40)
     self.window.update()
     cs.set_rgb((255, 0, 0))
     self.assertEqual(cs.get_hue(), 0)
     self.window.update()
     cs.set_hsv((0, 100, 100))
     self.assertEqual(cs.get_hue(), 0)
     self.window.update()
     self.assertEqual(cs.get(), ((255, 0, 0), (0, 100, 100), '#FF0000'))
     self.window.update()
Example #3
0
 def test_colorsquare_init(self):
     cs = tkc.ColorSquare(self.window, hue=60, height=200, width=200)
     cs.pack()
     self.window.update()