更新代码

master
bettleChen 11 months ago
parent 1125aa74ee
commit e2cb20c6aa

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -0,0 +1 @@
############### 请在右侧图形化界面,全屏展示界面,完成本关卡 ###################

@ -0,0 +1,6 @@
xrandr --addmode VNC-0 "1920x1080"
xrandr --output VNC-0 --mode "1920x1080"
nohup python3 x5/FunctionDisplay_X5.py &
echo "编译成功"
echo "运行成功"
echo "测评成功"

26
text

@ -0,0 +1,26 @@
self.func_input = Entry(bottom_frame, font=self.font_style, width=40)
self.func_input.grid(row=0, column=0, columnspan=6, padx=(15,0), pady=5)
self.add_func_button = Button(bottom_frame, text="用户命名并新增基本函数", command=self.add_function)
self.add_func_button.grid(row=0, column=6, columnspan=2,padx=10, pady=15, sticky="ne")
Label(bottom_frame, text="x步长", font=("Lucida Grande", 18)).place(x=15,y=80)
self.x_step = Entry(bottom_frame, font=self.font_style, width=10)
self.x_step.place(x=135, y=70, width=215,height=52)
Label(bottom_frame, text="x个数", font=("Lucida Grande", 18)).place(x=15,y=155)
self.x_count = Entry(bottom_frame, font=self.font_style, width=10)
self.x_count.place(x=135, y=150, width=215,height=52)
Label(bottom_frame, text="坐标轴", font=("Lucida Grande", 20)).grid(row=2, column=4,padx=(150,0))
self.quadrant = IntVar()
self.quadrant.set(4)
Radiobutton(bottom_frame, text="四象限", command=self.update_quadrant,
value=4, variable=self.quadrant).grid(row=1, column=5, sticky="sw",padx=(0,135))
Radiobutton(bottom_frame, text="一象限", command=self.update_quadrant,
value=1, variable=self.quadrant).grid(row=3, column=5, sticky="nw",padx=(0,135))
Label(bottom_frame, text="x放大倍数", font=("Lucida Grande", 18)).place(x=750,y=80)
self.x_scale = Entry(bottom_frame, font=self.font_style, width=10)
self.x_scale.grid(row=1, column=6, padx=(70,0), sticky="se")
Label(bottom_frame, text="y放大倍数", font=("Lucida Grande", 18)).place(x=750,y=160)
self.y_scale = Entry(bottom_frame, font=self.font_style, width=10)
self.y_scale.grid(row=3, column=6, sticky="ne")
Button(bottom_frame, text="输出", command=self.print_function, width=5) \
.grid(row=1, rowspan=3, column=8, padx=(30,0),sticky="w")

@ -1,5 +1,5 @@
from time import sleep from time import sleep
from ttkbootstrap import * from tkinter import *
import tkinter.font as tkFont import tkinter.font as tkFont
from tkinter import messagebox from tkinter import messagebox
@ -12,7 +12,9 @@ from numpy import arange
from sympy import symbols, lambdify from sympy import symbols, lambdify
from functionUtil import FunctionUtil from functionUtil import FunctionUtil
import math
from PIL import ImageTk, Image
import sys
# 在画布中央绘制文本 # 在画布中央绘制文本
def center_text(canvas, text, font): def center_text(canvas, text, font):
@ -26,16 +28,20 @@ class Graph(Canvas):
""" """
绘制函数图形 绘制函数图形
""" """
def __init__(self, master=None, **kwargs): def __init__(self, master=None, **kwargs):
super().__init__(master, **kwargs) super().__init__(master, **kwargs)
self.width = int(self.cget('width')) self.width = int(self.cget('width'))
self.height = int(self.cget('height')) self.height = int(self.cget('height'))
self.origin = (self.width / 2, self.height / 2) self.origin = (self.width / 2, self.height / 2)
self.config(bg="white")
self.bili_x = 20 self.bili_x = 20
self.bili_y = 20 self.bili_y = 20
self.draw_axis() self.draw_axis()
self.draw_scale() self.draw_scale()
self.fig = FigureCanvasTkAgg() self.fig = FigureCanvasTkAgg()
self.y_scale = 1.0
def draw_axis(self): def draw_axis(self):
""" """
@ -77,6 +83,7 @@ class Graph(Canvas):
self.draw_axis() self.draw_axis()
self.draw_scale() self.draw_scale()
def draw_graph_3d(self, func, draw_precision=0.1, count=1000, bili_x=20, bili_y=40, ): def draw_graph_3d(self, func, draw_precision=0.1, count=1000, bili_x=20, bili_y=40, ):
self.fig.get_tk_widget().destroy() self.fig.get_tk_widget().destroy()
self.delete("all") self.delete("all")
@ -93,16 +100,20 @@ class Graph(Canvas):
X, Y = np.meshgrid(X, Y) X, Y = np.meshgrid(X, Y)
Z = expr(X, Y) Z = expr(X, Y)
# 创建一个 Figure 对象 # 创建一个 Figure 对象
fig = Figure(figsize=(5.5, 6), dpi=100) fig = Figure(figsize=(7, 5.5), dpi=120)
# 在 Figure 上创建一个 3D 子图 # 在 Figure 上创建一个 3D 子图
ax = fig.add_subplot(111, projection='3d') ax = fig.add_subplot(111, projection='3d')
ax.auto_scale_xyz(X, Y, Z)
# 绘制三维图形 # 绘制三维图形
ax.plot_surface(X, Y, Z, cmap='viridis') ax.plot_surface(X, Y, Z, cmap='viridis')
self.fig = FigureCanvasTkAgg(fig, master=self) self.fig = FigureCanvasTkAgg(fig, master=self)
self.fig.draw() self.fig.draw()
self.fig.get_tk_widget().pack(fill=BOTH, ipadx=0, ipady=0, pady=0, padx=0) self.fig.get_tk_widget().pack(fill=BOTH, ipadx=0, ipady=0, pady=0, padx=0, expand=True)
def draw_graph(self, func, draw_precision=0.1, count=1000, bili_x=20, bili_y=40, c='blue'):
def draw_graph_2d(self, func, draw_precision=0.1, count=1000, bili_x=1, bili_y=1, c='blue'):
'xmin,xmax 自变量的取值范围; c 图像颜色' 'xmin,xmax 自变量的取值范围; c 图像颜色'
'x0,y0 原点坐标 w,h 横纵轴半长 draw_precision 步进' 'x0,y0 原点坐标 w,h 横纵轴半长 draw_precision 步进'
self.fig.get_tk_widget().destroy() self.fig.get_tk_widget().destroy()
@ -142,14 +153,14 @@ class Graph(Canvas):
class ExpressionCanvas(Canvas): class ExpressionCanvas(Canvas):
def __init__(self, master, *args, **kwargs): def __init__(self, master, *args, **kwargs):
super().__init__(master, *args, **kwargs) super().__init__(master, *args, **kwargs)
self.node_width = 60 self.node_width = 100
self.node_height = 30 self.node_height = 40
self.x_spacing = 10 self.x_spacing = 15
self.y_spacing = 70 self.y_spacing = 70
self.level = {} self.level = {}
def add_node(self, text, x, y, parent=None): def add_node(self, text, x, y, parent=None):
node_width = len(text) * 5 + 20 node_width = len(text) * 15 + 20
if node_width < 40: if node_width < 40:
node_width = 50 node_width = 50
# 创建节点 # 创建节点
@ -178,7 +189,7 @@ class ExpressionCanvas(Canvas):
self.level[coords[1]].append(coords[2]) self.level[coords[1]].append(coords[2])
else: else:
self.level[coords[1]] = [coords[2]] self.level[coords[1]] = [coords[2]]
text_id = self.create_text(x + 5, y + self.node_height // 2, text=text, anchor="center") text_id = self.create_text(x + 5, y + self.node_height // 2, text=text, anchor="center", font=("", 15))
sleep(0.2) sleep(0.2)
self.update() self.update()
# 绘制父节点和当前节点的连线 # 绘制父节点和当前节点的连线
@ -208,14 +219,17 @@ class ExpressionCanvas(Canvas):
return node return node
class FunctionDisplay(Frame): class FunctionDisplay(Canvas):
def __init__(self, master, attr): def __init__(self, master, *args, **kwargs):
super().__init__(master) super().__init__(master, *args, **kwargs)
self.attr = attr
self.font_style = tkFont.Font(family="Lucida Grande", size=30) self.font_style = tkFont.Font(family="Lucida Grande", size=30)
self.functions = FunctionUtil() self.functions = FunctionUtil()
self.width = int(self.cget("width"))
self.height = int(self.cget("height"))
self.background_img = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/背景@3x.jpg").resize((self.width, self.height)))
self.create_image(0, 0, image=self.background_img, anchor=NW)
self.master = master self.master = master
self.create_window() self.init_window()
self.load_user_function() self.load_user_function()
def add_function(self): def add_function(self):
@ -286,9 +300,10 @@ class FunctionDisplay(Frame):
def load_user_function(self): def load_user_function(self):
self.user_function_canvas.delete(ALL) self.user_function_canvas.delete(ALL)
self.user_function_canvas.create_text(20 + 90, 35, text='可识别基本函数', fill='red', font=("Purisa", 20, "bold")) self.user_function_canvas.create_text(20 + 90, 35, text='可识别基本函数', fill='red',
font=("Purisa", 20, "bold"))
num = 2 num = 2
self.user_function_canvas.create_text(0, 70, anchor="nw", text="函数", font=("", 15)) self.user_function_canvas.create_text(0, 70, anchor="nw", text="函数", font=("", 15))
self.user_function_canvas.create_text(100, 70, anchor="nw", text="函数体", font=("", 15)) self.user_function_canvas.create_text(100, 70, anchor="nw", text="函数体", font=("", 15))
for function, function_body in self.functions.data.items(): for function, function_body in self.functions.data.items():
self.user_function_canvas.create_text(0, 20 * num + 50, anchor="nw", text=function, font=("", 15)) self.user_function_canvas.create_text(0, 20 * num + 50, anchor="nw", text=function, font=("", 15))
@ -298,86 +313,107 @@ class FunctionDisplay(Frame):
self.user_function_canvas.configure(scrollregion=self.user_function_canvas.bbox("all")) self.user_function_canvas.configure(scrollregion=self.user_function_canvas.bbox("all"))
def create_form(self): def create_form(self):
bottom_frame = Frame(self.master, width=self.attr["width"], height=self.attr["height"] * 0.3) bottom_frame = Canvas(self, width=self.width, height=self.height * 0.3, highlightthickness=0)
self.func_input = Entry(bottom_frame, font=self.font_style, width=40) self.back_image = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/下部背景@3x.png").resize((self.width, int(self.height * 0.3))))
self.func_input.grid(row=0, column=0, columnspan=4, padx=30) bottom_frame.create_image(0, 0, image=self.back_image, anchor=NW)
self.add_func_button = Button(bottom_frame, text="用户命名并新增基本函数", command=self.add_function) label_width, entry_width, label_margin_left, margin_left, height, margin_top = 100, 215, 120 + 50, 120, 42, 20
self.add_func_button.grid(row=0, column=4, padx=10) self.func_input = Entry(bottom_frame, font=self.font_style)
Label(bottom_frame, text="x步长", font=("Lucida Grande", 20)).grid(row=1, column=0, padx=30) self.func_input.place(x=margin_left, y=margin_top, anchor=NW, width=1000, height=height)
self.x_step = Entry(bottom_frame, font=self.font_style, width=10) self.add_func_image = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/用户命名并新增基本函数@3x.png").resize((150, 42)))
self.x_step.grid(row=1, column=1, padx=10, pady=10) self.add_func_button = Button(bottom_frame, image=self.add_func_image, bd=0, relief="solid", bg="#f7f7f7",
Label(bottom_frame, text="x个数", font=("Lucida Grande", 20)).grid(row=1, column=2, padx=30) highlightthickness=0, command=self.add_function)
self.x_count = Entry(bottom_frame, font=self.font_style, width=10) self.add_func_button.place(x=1140, y=20, anchor=NW)
self.x_count.grid(row=1, column=3, padx=10, pady=10)
self.label_img = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/文字背景@3x.png").resize((100, 42)))
Label(bottom_frame, text="坐标轴", font=("Lucida Grande", 20)).grid(row=2, column=0, padx=30) bottom_frame.create_image(label_margin_left, 112, image=self.label_img)
bottom_frame.create_text(label_margin_left, 112, text="x步长", fill="white", font=("", 20))
self.x_step = Entry(bottom_frame, font=self.font_style)
self.x_step.place(x=margin_left + label_width, y=112 - 21, width=215, height=42)
self.label1_img = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/文字背景@3x.png").resize((100, 42)))
bottom_frame.create_image(label_margin_left, 171, image=self.label1_img)
bottom_frame.create_text(label_margin_left, 170, text="x个数", fill="white", font=("", 20))
self.x_count = Entry(bottom_frame, font=self.font_style)
self.x_count.place(x=margin_left + label_width, y=112 + 39, width=215, height=42)
self.big_label_img = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/文字背景2@3x.png").resize((label_width+5, height * 2 + margin_top)))
bottom_frame.create_image(label_margin_left + label_width + entry_width + 108, 112 + 31, image=self.big_label_img)
bottom_frame.create_text(label_margin_left + label_width + entry_width + 108, 112 + 31, text="坐标轴", fill="white", font=("", 25))
self.quadrant = IntVar() self.quadrant = IntVar()
self.quadrant.set(4) self.quadrant.set(4)
Radiobutton(bottom_frame, text="四象限", command=self.update_quadrant, Radiobutton(bottom_frame, text="四象限", command=self.update_quadrant, font=("", 17),
value=4, variable=self.quadrant).grid(row=2, column=1, padx=10, pady=10) bg="#b9b9f7",highlightthickness=0, highlightcolor="#aaaaf2",
Radiobutton(bottom_frame, text="一象限", command=self.update_quadrant, value=4, variable=self.quadrant).place(x=label_margin_left + label_width * 2 + entry_width +58, y=90,
value=1, variable=self.quadrant).grid(row=2, column=2, padx=10, pady=10) height=(height * 2 + margin_top) / 2, width=entry_width, anchor=NW)
Label(bottom_frame, text="x放大倍数", font=("Lucida Grande", 20)).grid(row=3, column=0, padx=30) Radiobutton(bottom_frame, text="一象限", command=self.update_quadrant, font=("", 17), bg="#b9b9f7",
self.x_scale = Entry(bottom_frame, font=self.font_style, width=10) highlightthickness=0, highlightcolor="#aaaaf2",
self.x_scale.grid(row=3, column=1, padx=10, pady=10) value=1, variable=self.quadrant).place(x=label_margin_left + label_width * 2 + entry_width +58, y=90 + (height * 2 + margin_top) / 2,
Label(bottom_frame, text="y放大倍数", font=("Lucida Grande", 20)).grid(row=3, column=2, padx=30) height=(height * 2 + margin_top) / 2, width=entry_width, anchor=NW)
self.y_scale = Entry(bottom_frame, font=self.font_style, width=10)
self.y_scale.grid(row=3, column=3, padx=10, pady=10)
Button(bottom_frame, text="输出", command=self.print_function, width=5)\
.grid(row=1, rowspan=3, column=4, sticky="w") self.x_scale = Entry(bottom_frame, font=self.font_style)
bottom_frame.place(x=0, y=self.attr["height"] * 0.65 + 20) self.x_scale.place(x=margin_left + label_width, y=112 - 21, width=215, height=42)
label_x = label_margin_left + 840
def create_window(self): label_y = 112
self.axis_canvas = Graph(self.master, width=self.attr["width"] * 0.45, height=self.attr["height"] * 0.65, self.label_img1 = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/文字背景@3x.png").resize((130, 42)))
bg="#cdcdcd") bottom_frame.create_image(label_x, label_y, image=self.label_img1)
self.axis_canvas.place(x=0, y=0) bottom_frame.create_text(label_x, label_y, text="x放大倍数", fill="white", font=("", 20))
self.text_canvas = ExpressionCanvas(self.master, width=self.attr["width"] * 0.35, entry_x = margin_left + label_width + 855
height=self.attr["height"] * 0.65, bg="#cdcdcd") entry_y = 112 - 21
self.text_canvas.place(x=int(self.attr["width"] * 0.45), y=0) self.x_scale.place(x=entry_x, y=entry_y, width=215, height=42)
user_function = Frame(self.master, width=self.attr["width"] * 0.2, height=self.attr["height"] * 0.65)
user_function.place(x=int(self.attr["width"] * 0.8), y=0)
self.user_function_canvas = Canvas(user_function, width=self.attr["width"] * 0.18, self.y_scale = Entry(bottom_frame, font=self.font_style)
height=self.attr["height"] * 0.63, background="#cdcdcd") self.y_scale.place(x=margin_left + label_width, y=112 - 21, width=215, height=42)
label_x = label_margin_left + 840
label_y = 170
bottom_frame.create_image(label_x, label_y, image=self.label_img1)
bottom_frame.create_text(label_x, label_y, text="y放大倍数", fill="white", font=("", 20))
entry_x = margin_left + label_width + 855
entry_y = 170 - 21
self.y_scale.place(x=entry_x, y=entry_y, width=215, height=42)
self.print_function_image = ImageTk.PhotoImage(Image.open(sys.path[0]+"/./image/输出-点击@3x.png").resize((100, 42)))
self.print_function_button = Button(bottom_frame, image=self.print_function_image, bd=0, relief="solid", bg="#f7f7f7",
highlightthickness=0, command=self.print_function)
self.print_function_button.place(x=1350, y=95, anchor=NW)
# Button(bottom_frame, text="输出", command=self.print_function, width=5) \
# .place(x=1350, y=95, anchor=NW)
bottom_frame.place(x=0, y=self.height * 0.65 + 40, anchor=NW)
def init_window(self):
self.axis_canvas = Graph(self, width=self.width * 0.45, height=self.height * 0.65,highlightthickness=0)
self.axis_canvas.place(x=0, y=0, anchor=NW)
self.text_canvas = ExpressionCanvas(self, width=self.width * 0.35,
height=self.height * 0.65, bg="white",highlightthickness=0)
self.text_canvas.place(x=int(self.width * 0.45), y=0)
user_function = Frame(self, width=self.width * 0.2, height=self.height * 0.65)
user_function.place(x=int(self.width * 0.8), y=0)
self.user_function_canvas = Canvas(user_function, width=self.width * 0.19,
height=self.height * 0.65, bg="white",highlightthickness=0)
y_scrollbar = Scrollbar(user_function, orient="vertical", command=self.user_function_canvas.yview) y_scrollbar = Scrollbar(user_function, orient="vertical", command=self.user_function_canvas.yview)
x_scrollbar = Scrollbar(user_function, orient="horizontal", command=self.user_function_canvas.xview) x_scrollbar = Scrollbar(user_function, orient="horizontal", command=self.user_function_canvas.xview)
x_scrollbar.pack(side=BOTTOM, fill=BOTH) x_scrollbar.pack(side=BOTTOM, fill=BOTH)
y_scrollbar.pack(side=RIGHT, fill=BOTH) y_scrollbar.pack(side=RIGHT, fill=BOTH)
self.user_function_canvas.pack(side=TOP, fill=BOTH) self.user_function_canvas.pack(side=TOP, fill=BOTH)
self.user_function_canvas.config(yscrollcommand=y_scrollbar.set, xscrollcommand=x_scrollbar.set) self.user_function_canvas.config(yscrollcommand=y_scrollbar.set, xscrollcommand=x_scrollbar.set)
for i in range(1, 200):
self.user_function_canvas.create_text(80, i * 20 + 35, text="fdsaf{}".format(i))
self.user_function_canvas.config(scrollregion=self.user_function_canvas.bbox("all")) self.user_function_canvas.config(scrollregion=self.user_function_canvas.bbox("all"))
self.create_form() self.create_form()
if __name__ == '__main__': if __name__ == '__main__':
from pycallgraph2 import PyCallGraph root = Tk()
from pycallgraph2.output import GraphvizOutput
from pycallgraph2 import Config
from pycallgraph2 import GlobbingFilter
root = Window()
screenwidth = root.winfo_screenwidth() screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight() screenheight = root.winfo_screenheight()
root_attr = { root_attr = {
"width": 1200, "width": int(screenwidth * 1),
"height": 800, "height": int(screenheight * 1),
} }
alignstr = '%dx%d+%d+%d' % (root_attr['width'], root_attr['height'], (screenwidth - root_attr['width']) / 2, alignstr = '%dx%d+%d+%d' % (root_attr['width'], root_attr['height'], (screenwidth - root_attr['width']) / 2,
(screenheight - root_attr['height']) / 2) (screenheight - root_attr['height']) / 2)
root.geometry(alignstr) root.geometry(alignstr)
root.resizable(width=False, height=False) root.resizable(width=False, height=False)
output = GraphvizOutput(font_size=30) app = FunctionDisplay(root, width=root_attr["width"], height=root_attr["height"])
output.output_file = "basic.png" app.place(x=0, y=0, anchor=NW)
output.group_font_size = 40
config = Config()
config.trace_filter = GlobbingFilter(include=[
'FunctionDisplay.*',
'Graph.*',
'ExpressionCanvas.*',
'FunctionUtil.*'
])
with PyCallGraph(output=output, config=config):
app = FunctionDisplay(root, root_attr)
ttk.Style().configure("TButton", font="-size 18")
ttk.Style().configure("TRadiobutton", font="-size 18")
root.mainloop() root.mainloop()

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

@ -0,0 +1 @@
{"xy": "x*y", "sinx": "sin(x)", "cosx": "cos(x)", "y": "sin(x)*cos(x)", "SinPlusCon": "sin(x)+cos(x)", "tanx": "tan(x)"}

@ -0,0 +1,57 @@
import json
import re
class FunctionUtil:
def __init__(self):
self.filename = "./function.json"
self.data = {}
self.load()
def load(self):
"""
加载文件数据
"""
try:
with open(self.filename, 'r', encoding="utf-8") as f:
self.data = json.load(f)
except FileNotFoundError:
pass
def save(self):
"""
将函数保存至json文件当中
"""
with open(self.filename, "w", encoding="utf-8") as f:
json.dump(self.data, f)
def check_function_exit(self, function):
"""
检查用户输入的函数是否包含用户自定义函数
"""
for key in self.data.keys():
if function.find(key) >=0:
return True
return False
def add_function(self, key, value):
"""
添加函数
"""
self.data[key.strip()] = value.strip()
self.save()
def get_function_by_iter(self, key):
result = key
for dict_key in self.data.keys():
if result.find(dict_key) >= 0:
value = result.replace(dict_key, self.data[dict_key])
result = self.replace_values_recursive(value)
return result
def replace_values_recursive(self, value):
for key in self.data:
if key in value:
replacement = self.data[key]
value = value.replace(key, replacement)
return value

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save