Created
March 8, 2013 19:58
-
-
Save danjamker/5119370 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdout | |
from time import sleep | |
def printOnline(s, text): | |
if s == int(text): | |
stdout.write("(%d)," % int(text)) | |
else: | |
stdout.write(text+",") | |
def printLine(): | |
stdout.write("\n") | |
def printa(text): | |
stdout.write(text) | |
def printSelected(text): | |
stdout.write("(%c)" % text) | |
right = 2 | |
left = 2 | |
rightpad = 2 | |
leftpad = 2 | |
window = 3 | |
a = ['0','1','2','3','4','5','6','7','8','9','10','11','12'] | |
def p(selected): | |
leftpadb = 0 | |
rightpadb = 0 | |
leftelips = 0 | |
rightelips = 0 | |
s = selected | |
for i in range(0, left): | |
printOnline(s, a[i]) | |
if selected - ( left + leftpad) >= 0 and leftelips == 0: | |
printa('.'); | |
printa('.'); | |
leftelips = 1 | |
for i in range(left, len(a)-right): | |
if i <= selected + (window /2) and i >= selected - ((window/2)): | |
printOnline(s, a[i]) | |
if selected < len(a) -(right + rightpad + (window/2)) and rightelips == 0: | |
printa('.'); | |
printa('.'); | |
rightelips = 1 | |
for i in range(len(a)-right, len(a)): | |
printOnline(s, a[i]) | |
printLine() | |
p(0); | |
p(1); | |
p(2); | |
p(3); | |
p(4); | |
p(5); | |
p(6); | |
p(7); | |
p(8); | |
p(9); | |
p(10); | |
p(11); | |
p(12); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment