Exemplo n.º 1
0
Arquivo: autex.py Projeto: ganow/autex
 def on_modified(self, event):
     if event.is_directory:
         print cyan('directory \'{0}\' modified.'.format(event.src_path))
     else:
         if self.detector in event.src_path:
             print yellow('file \'{0}\' modified.'.format(event.src_path))
             self.exec_command()
         else:
             # print white('file \'{0}\' modified.'.format(event.src_path))
             pass
Exemplo n.º 2
0
def menu():
	"""Menu for the game"""
	print cyan('Menu')
	prompt = "P)lay\n"
	prompt = prompt + "R)ules of the game\n"
	prompt = prompt + "D)isplay high scores\n"
	prompt = prompt + "Q)uit\n"
	prompt = prompt + "Please choose one:"
	choices = ("P", "p", "R", "r", "D", "d", "Q", "q")
	c = userChoice(prompt, choices)
	if c=='q' or c=='Q':
			print "You quit..."
			return 0
	elif c=='p' or c=='P':
		play()
	elif c=='d' or c=='D':
		os.system('clear')
		scorelist()
	elif c=='r' or c=='R':
		os.system('clear')
		rules()
	'''else:
		c = userChoice(prompt, choices)'''
	'''
Exemplo n.º 3
0
def play():
	"""Play function of the game."""
	usedtime = 0.0
	remtime = 0.0
	twords = 0
	cwords = 0
	inp = 'ttemp'
	alllen = 0
	i = 1
	listi = makelist()
	while True:
		try:
			x = int(raw_input("How many sentence will you type?\n>>"))
			break
		except ValueError:
			print red("Oops!  That was no valid number.  Try again...")
	raw_input('>>Press Enter to start the game')
	start = time.time()
	while (i <= x):
		word = randomword(listi)
		i += 1
		alllen += len(word)
		listi.remove(word)
		#remtime = 60.0 - usedtime
		#print remtime
		os.system('clear')
		print time.time() - start
		while (inp != word):
			print purple("-" * 90)
			print '>>' + cyan(word)
			print purple("-" * 90)
			inp = raw_input('>>')
			print "\n\n"
			if (inp == 'quit'):
				return 0
			
	end = time.time()
	usedtime = (end - start)
		#twords += 1
	os.system('clear')
	print red("\nIt's done!")
	print "-" * 90
	print "time:" + str(usedtime)
	mtime = usedtime/60
	wcount = alllen/5
	print yellow("WPM:" + str(wcount/mtime))
	print "Words Count:" + str(alllen)
	print "-" * 90
	'''
	print "Total no. of words:", twords
	incwords=twords - cwords
	print "No. of incorrect words", incwords
	raw=(twords/usedtime) * 60.0
	print "RAW words per minute %.2f" %raw
	actual=(cwords/usedtime) * 60.0
	print "Actual words per minute: %.2f"%actual
	scores=scorelist()
	addscore(scores,actual)
	writescore(scores)
	'''
	menu()
Exemplo n.º 4
0
def rules():
	"""Rules of the game"""
	print cyan("Welcome\nTest your typing skills...\nType as many words as you can in under 60 seconds and get your RAW words per minute and actual words per minute\n")
	raw_input(red('Press Enter'))
	menu()