Exemple #1
0
	def __init__(self, root):
		self.root = root
		self.fade = Fade(256) #default 0-255
		self.label = Label(root, text="text", fg="#000000", font=("Arial", 54))
		self.label.pack()
		Button(root, text="Reset", command=self.reset).pack()
		self.fade_more()
Exemple #2
0
class Demo(object):
	def __init__(self, root):
		self.root = root
		self.fade = Fade(256) #default 0-255
		self.label = Label(root, text="text", fg="#000000", font=("Arial", 54))
		self.label.pack()
		Button(root, text="Reset", command=self.reset).pack()
		self.fade_more()

	def reset(self):
		self.fade.reset()
		self.fade_more()

	def fade_more(self):
		try:
			current = self.fade.next()
			self.label.config(fg=dec2hex(current)) #configures text to next color
			self.label.pack()
			root.after(100, self.fade_more)
		except StopIteration:
			return
Exemple #3
0
def test_reset():
	f = Fade(10)
	for each in f:
		pass
	f.reset()
	assert f.index == 0
Exemple #4
0
def test_negative(start):
	f = Fade(10)
	ans = f.find_int(10, 255, start)
	assert len(ans) == 11
	assert ans[-1] == start
Exemple #5
0
def test_start(start):
	f = Fade(10)
	ans = f.find_int(10, start, 255)
	assert len(ans) == 11
	assert ans[-1] == 255
Exemple #6
0
def test_range(largest):
	f = Fade(10)
	ans = f.find_int(10, 0, largest)
	assert len(ans) == 11
	assert ans[-1] == largest
Exemple #7
0
def test_last_number_255(steps):
	f = Fade(steps)
	ans = f.find_int(steps, 0, 255)
	assert ans[-1] == 255
Exemple #8
0
def test_find_int_len(steps):
	f = Fade(steps)
	assert len(f.find_int(steps, 0, 255)) == steps+1