code/media_lib.py
def wrapline(text, font, maxwidth): 
	""" this functions splits a string into a list, making lines that fit into a given width.
	It can also deal with newlines by first splitting the text into paragraphs (sort of), then applieing the the 
	text-break to each paragraph and putting this into a final list.
	"""


	all_lines = []			# includes all lines, with textbreak and newline chracters included

	ntext = text.split('\n')			# the text, but split into the lines ('n' as in newlin

	#print("[ML WL] split to newlines:", ntext)

	for line in ntext:					# then goes through the lines (or paragraphs if you will)
		done=0 
		wrapped=[]

		while not done:   				# in this while all the text break magic happens
			nl, done, stext=truncline(line, font, maxwidth) 
			wrapped.append(stext.strip())                  
			line=line[nl:]

		for wrapped_line in wrapped:			# puts all new wrapped lines to the list
			all_lines.append(wrapped_line)

	#print("[ML WL] all wrapped lines:", all_lines)                           
	return all_lines
 this functions splits a string into a list, making lines that fit into a given width.
	It can also deal with newlines by first splitting the text into paragraphs (sort of), then applieing the the 
	text-break to each paragraph and putting this into a final list.
	
this functions splits a string into a list, making lines that fit into a given width.
It can also deal with newlines by first splitting the text into paragraphs (sort of), then applieing the the
text-break to each paragraph and putting this into a final list.
this functions splits a string into a list making lines that fit into a given width . It can also deal with newlines by first splitting the text into paragraphs ( sort of ) then applieing the the text - break to each paragraph and putting this into a final list .
def wrapline(text, font, maxwidth): 
	all_lines = []			
	ntext = text.split('\n')			
	for line in ntext:					
		done=0 
		wrapped=[]
		while not done:   				
			nl, done, stext=truncline(line, font, maxwidth) 
			wrapped.append(stext.strip())                  
			line=line[nl:]
		for wrapped_line in wrapped:			
			all_lines.append(wrapped_line)
	return all_lines
def wrapline ( text , font , maxwidth ) : all_lines = [ ] ntext = text . split ( '\n' ) for line in ntext : done = 0 wrapped = [ ] while not done : nl , done , stext = truncline ( line , font , maxwidth ) wrapped . append ( stext . strip ( ) ) line = line [ nl : ] for wrapped_line in wrapped : all_lines . append ( wrapped_line ) return all_lines
this functions splits a string into a list, making lines that fit into a given width.
this functions splits a string into a list making lines that fit into a given width .
""" this functions splits a string into a list, making lines that fit into a given width.
	It can also deal with newlines by first splitting the text into paragraphs (sort of), then applieing the the 
	text-break to each paragraph and putting this into a final list.
	""" # includes all lines, with textbreak and newline chracters included # the text, but split into the lines ('n' as in newlin #print("[ML WL] split to newlines:", ntext) # then goes through the lines (or paragraphs if you will) # in this while all the text break magic happens # puts all new wrapped lines to the list #print("[ML WL] all wrapped lines:", all_lines)                           
text
font
maxwidth