Refactor the following python 3.12 code. Do not use new libraries. Focus on reducing complexity and clean code. Only use one line docstrings. Code: import math
import tkinter as tk
from tkinter import ttk
import ctypes
from tkinter import font as tkFont

# --- Tkinter App ---

class CalculatorGUI:
    def __init__(self, master):
        self.master = master
        self.set_dpi_awareness()
        self.create_widgets()
        self.configure_grid()
    
    def set_dpi_awareness(self):
        """Set the DPI awareness for high-DPI displays on Windows."""
        try:
            ctypes.windll.shcore.SetProcessDpiAwareness(1)
        except Exception as e:
            print(f"Could not set DPI awareness: {e}")

    def create_widgets(self):
        """Create and place all the widgets in the main window."""
        self.master.title("Calculator")
        roboto_font = tkFont.Font(family="Roboto Flex", size=16)

        self.expression_var = tk.StringVar()

        # Entry field for input
        self.entry = ttk.Entry(self.master, textvariable=self.expression_var, font=roboto_font, width=50)
        self.entry.grid(row=0, column=0, padx=5, pady=5, sticky="ew")
        self.entry.bind("<Return>", self.calculate)

        # Text widget for displaying history
        self.history_text = tk.Text(self.master, width=70, height=10, font=roboto_font, wrap="none", state=tk.DISABLED)
        self.history_text.grid(row=1, column=0, padx=5, pady=5, sticky="nsew")

        # Scrollbar for the history text widget
        scrollbar = ttk.Scrollbar(self.master, orient="vertical", command=self.history_text.yview)
        scrollbar.grid(row=1, column=1, sticky="ns")
        self.history_text.configure(yscrollcommand=scrollbar.set)

        # Label for supported functions and constants
        supported_info = (
            "Functions: sqrt, sin, cos, tan, log, ln, exp\n"
            "Constants: pi, e\n"
            "Conversions: lb(kg), kg(lb)"
        )
        self.supported_label = ttk.Label(self.master, text=supported_info, font=roboto_font)
        self.supported_label.grid(row=2, column=0, padx=5, pady=10, sticky="w")

    def configure_grid(self):
        """Configure the grid layout to make it responsive."""
        self.master.columnconfigure(0, weight=1)
        self.master.rowconfigure(1, weight=1)

    def calculate(self, event=None):
        """Evaluate the expression and display the result."""
        expression = self.expression_var.get()
        result = evaluate_expression(expression)
        self.display_result(expression, result)
        self.expression_var.set("")  # Clear the input field

    def display_result(self, expression, result):
        """Display the result in the history text widget."""
        self.history_text.config(state=tk.NORMAL)
        self.history_text.insert(tk.END, f"{expression} = {result}\n")
        self.history_text.config(state=tk.DISABLED)
        self.history_text.see(tk.END)

#--- Functions ---

def evaluate_expression(expression):
    """Evaluate a mathematical expression safely."""
    safe_functions = {
        'sqrt': math.sqrt,
        'sin': math.sin,
        'cos': math.cos,
        'tan': math.tan,
        'log': math.log10,
        'ln': math.log,
        'exp': math.exp,
        'pi': math.pi,
        'e': math.e,
        'lb': kg_to_lb,
        'kg': lb_to_kg
    }

    expression = expression.replace('^', '**')

    try:
        result = eval(expression, {"__builtins__": None}, safe_functions)
        return round(result, 2) if isinstance(result, (int, float)) else result
    except Exception as e:
        return f"Error: {str(e)}"

#--- Conversions ---

def kg_to_lb(kg):
    """Convert kilograms to pounds."""
    return kg * 2.20462262

def lb_to_kg(lb):
    """Convert pounds to kilograms."""
    return lb / 2.20462262

#--- Main ---

def main():
    """Create and run the main application window."""
    root = tk.Tk()
    root.geometry("1200x720")
    CalculatorGUI(root)
    root.mainloop()

if __name__ == "__main__":
    main()