def __init__(self, text, fontsize, x_position, y_position, width, root): self.text = text self.font = Font(fontsize) self.x_positon = x_position self.y_position = y_position self.width = width self.root = root.root
def __init__(self, x_position, y_position, width, height, text, command, fontsize, root): self.font = Font(fontsize) self.x_positon = x_position self.y_position = y_position self.width = width self.height = height self.text = text self.command = command self.root = root.root
def __init__(self, x_position, y_position, width, height, disabled, multiline, root): self.font = Font(16) self.x_positon = x_position self.y_position = y_position self.width = width self.height = height self.root = root.root self.content = [] self.disabled = disabled self.text = Text(self.root, font=self.font.get_font()) if disabled == True: self.text.config(state=DISABLED) if multiline == False: self.text.config(wrap='none')
class DText: def __init__(self, x_position, y_position, width, height, disabled, multiline, root): self.font = Font(16) self.x_positon = x_position self.y_position = y_position self.width = width self.height = height self.root = root.root self.content = [] self.disabled = disabled self.text = Text(self.root, font=self.font.get_font()) if disabled == True: self.text.config(state=DISABLED) if multiline == False: self.text.config(wrap='none') def get_properties(self): return [self.x_positon, self.y_position, self.width, self.height] def add_text(self, text, limit): try: if (limit == len(self.content)): raise NameError( "Limit of files has been reached. Clear files to add files again.", True) elif text not in self.content: self.content.append(text) self.set_text('\n'.join(self.content)) except Exception as e: MessageDialog().show_error(e.args[0]) def set_text(self, text): self.text.config(state='normal') self.text.delete('1.0', END) self.text.insert('1.0', text) self.text.update_idletasks() self.text.config(state=DISABLED) def clear_content(self): self.text.config(state='normal') self.text.delete('1.0', END) self.text.update_idletasks() if self.disabled == True: self.text.config(state=DISABLED) self.content = [] def get_contents(self): return self.text.get('1.0', END) def get_element(self): return self.text
class DLabel: def __init__(self, text, fontsize, x_position, y_position, width, root): self.text = text self.font = Font(fontsize) self.x_positon = x_position self.y_position = y_position self.width = width self.root = root.root def get_properties(self): return [self.x_positon, self.y_position, self.width, None] def get_element(self): return Label(self.root, text=self.text, font=self.font.get_font(), justify=LEFT)
class DButton: def __init__(self, x_position, y_position, width, height, text, command, fontsize, root): self.font = Font(fontsize) self.x_positon = x_position self.y_position = y_position self.width = width self.height = height self.text = text self.command = command self.root = root.root def get_properties(self): return [self.x_positon, self.y_position, self.width, self.height] def get_element(self): return Button(self.root, text=self.text, command=self.command, font=self.font.get_font())
class DMessage: def __init__(self, text, fontsize, x_position, y_position, width, alignment, root): self.text = text self.font = Font(fontsize) self.x_positon = x_position self.y_position = y_position self.width = width self.alignment = alignment self.root = root.root def get_properties(self): return [self.x_positon, self.y_position, None, None] def get_element(self): return Message(self.root, text=self.text, font=self.font.get_font(), justify=self.alignment, width=self.width)