Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
copy.copy solution in Clear category for Text Editor by David_Jones
from copy import copy
class Text:
def __init__(self):
self.current_text = ''
self.font = None
def write(self, new_text):
self.current_text += new_text
def set_font(self, font_name):
self.font = font_name
def show(self):
tag = '' if self.font is None else f'[{self.font}]'
return tag + self.current_text + tag
def restore(self, text):
self.current_text = text.current_text
self.font = text.font
class SavedText(list):
def save_text(self, text):
self.append(copy(text))
def get_version(self, i):
return self[i]
May 21, 2019