Ejemplo n.º 1
0
	def get_account(self, login, passwd):
		if self.accounts.has_key(login):
			if self.accounts[login].passwd == passwd:
				return self.accounts[login]
			else:
				return 0
		else:
			self.accounts[login] = char.char(login, passwd)
			return self.accounts[login]
Ejemplo n.º 2
0
 def __init__(self, xml_line):
     (left, top, self._width, self._height) = xml_line.get('bbox').split(',')
     self._width = int(float(self._width))
     self._height = int(float(self._height))
     self._x = int(float(left)) - self._width
     self._y = int(float(top)) - self._height
     #
     xml_string = xml_line.find_all('text')
     self._chars = []
     for c in xml_string:
         self._chars.append(char(c))
     #
     self._font = self._chars[0].font if len(self._chars) > 0 else None
     self._size = self._chars[0].size if len(self._chars) > 0 else None
Ejemplo n.º 3
0
 def __init__(self, xml_line):
     (left, top, self._width,
      self._height) = xml_line.get('bbox').split(',')
     self._width = int(float(self._width))
     self._height = int(float(self._height))
     self._x = int(float(left)) - self._width
     self._y = int(float(top)) - self._height
     #
     xml_string = xml_line.find_all('text')
     self._chars = []
     for c in xml_string:
         self._chars.append(char(c))
     #
     self._font = self._chars[0].font if len(self._chars) > 0 else None
     self._size = self._chars[0].size if len(self._chars) > 0 else None
Ejemplo n.º 4
0

parens = between_(lparen, rparen)
braces = between_(lbrace, rbrace)
angles = between_(langle, rangle)
brackets = between_(lbracket, rbracket)

whiteSpace = skipMany(space)


def trailing_space(parser):
    "Skips trailing whitespace"
    return parser >= (lambda p: whiteSpace >> lift(p))


comma = trailing_space(char(','))
semi = trailing_space(char(';'))
colon = trailing_space(char(':'))
dot = trailing_space(char('.'))

sepBy_ = lambda sep: lambda parser: sepBy(parser, sep)
sepBy1_ = lambda sep: lambda parser: sepBy1(parser, sep)

semiSep = sepBy_(semi)
semiSep1 = sepBy1_(semi)

commaSep = sepBy_(comma)
commaSep1 = sepBy1_(comma)


def updateSign(sign, num):
Ejemplo n.º 5
0
		Chars = []
		imgGrayscale, imgThresh = pre.preprocess(image)
		cv2.imshow("thresh", imgThresh)

		# imgThresh = cv2.morphologyEx(imgThresh, cv2.MORPH_CLOSE, kernel)
		# cv2.imshow("close", imgThresh)

		contours, hi = cv2.findContours(imgThresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

		imcontours = np.zeros_like(image)
		imcontours = cv2.drawContours(imcontours, contours, -1, (255, 255, 0), 1)
		cv2.imshow("contours", imcontours)

		Sigs = []
		for contour in contours:
			sig = char.char(contour)
			Sigs.append(sig)

		imcontours = np.zeros_like(image)
		for sig in Sigs:
			imcontours = cv2.rectangle(imcontours, (sig.x, sig.y), (sig.x + sig.w, sig.y + sig.h), (255, 255, 0), 1)
		cv2.imshow("rectangleContour", imcontours)


		for s1 in Sigs:
			for s2 in Sigs:
				if s1 == s2:
					continue
				if (s1.Area < 60 or s2.Area < 60) or math.sqrt((s1.x - s2.x)**2 + (s1.y - s2.y)**2) > 50:
					continue
				if not pre.checkHop(s1, s2):
Ejemplo n.º 6
0
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
 
pygame.init()
 
# Set the width and height of the screen [width, height]
size = (SCREEN_WIDTH, SCREEN_HEIGHT)
screen = pygame.display.set_mode(size)

# Set the Window Name
pygame.display.set_caption("PyAsteroids")

# Initialize Character Variables
scale = [1, 1]

char = char(size, 'triangle.png', .05, 2, scale)
    

# Define define game loop function:
def game(screen, char, level):
    char = char 
    roids = []
    sc_x = screen.get_width()
    sc_y = screen.get_height()
    scale = []
    scale.append(sc_x/1024)
    scale.append(sc_y/768)
    for x in range(0,4):
        ro = new_roid(3, size, False, char.rect.center, scale)
        roids.append(ro)
    
Ejemplo n.º 7
0
parens   = between_(lparen, rparen)
braces   = between_(lbrace, rbrace)
angles   = between_(langle, rangle)
brackets = between_(lbracket, rbracket)


whiteSpace = skipMany(space)


def trailing_space(parser):
    "Skips trailing whitespace"
    return parser >= (lambda p: whiteSpace >> lift(p))


comma = trailing_space(char(','))
semi  = trailing_space(char(';'))
colon = trailing_space(char(':'))
dot   = trailing_space(char('.'))



sepBy_  = lambda sep: lambda parser: sepBy(parser, sep)
sepBy1_ = lambda sep: lambda parser: sepBy1(parser, sep)

semiSep  = sepBy_(semi)
semiSep1 = sepBy1_(semi)

commaSep  = sepBy_(comma)
commaSep1 = sepBy1_(comma)