def catch_stdin(self):
		"""Catch input from stdin and redraw"""
		# Wait for a line on stdin
		comm = sys.stdin.readline()[:-1]

		# If the line is not empty
		if comm:
			# Parse a message
			if comm[0] == "M":
				self.message = comm[2:].strip()
			# Parse subtext
			if comm[0] == "S":
				# self.subtext += " "
				self.subtext = comm[2:].strip()

		# Redraw the ui
		self.queue_draw()

		# Fire this function again in 10ms, as we're waiting on IO in readline anyway
		gobject.timeout_add(10, self.catch_stdin)
Catch input from stdin and redraw
howdy-gtk/src/authsticky.py