创建函数调用图

newBranch
bettleChen 2 years ago
parent f0a03788f1
commit 5e9fa516ad

@ -49,4 +49,8 @@ def create_table():
""") """)
cursor.close() cursor.close()
conn.close() # 关闭链接 conn.close() # 关闭链接
if __name__ == '__main__':
create_database()
create_table()

@ -80,11 +80,10 @@ def sc_random_record():
conn.commit() conn.commit()
student_random_record() if __name__ == '__main__':
course_random_record() student_random_record()
sc_random_record() course_random_record()
sc_random_record()
# 关闭数据库连接
# 关闭数据库连接 cursor.close()
cursor.close() conn.close()
conn.close()

@ -4,7 +4,7 @@ import pymysql
conn = pymysql.connect(user="root", password="cyh0110", database="SCT", host="127.0.0.1", port=3306) conn = pymysql.connect(user="root", password="cyh0110", database="SCT", host="127.0.0.1", port=3306)
cursor = conn.cursor() # 游标的定义、打开 cursor = conn.cursor() # 游标的定义、打开
# 字符串型SQL语句的执行 # 字符串型SQL语句的执行
SQLString = "INSERT INTO student VALUES ('20230001', '张三', '', 20, '01')" SQLString = "INSERT INTO student VALUES ('20220001', '张三', '', 20, '01')"
cursor.execute(SQLString) cursor.execute(SQLString)
SQLString = "INSERT INTO course VALUES ('1001', '数据库', 3, 48, 'T01')" SQLString = "INSERT INTO course VALUES ('1001', '数据库', 3, 48, 'T01')"
cursor.execute(SQLString) cursor.execute(SQLString)

@ -291,10 +291,6 @@ class StuSys_X4(BaseWindow):
if __name__ == '__main__': if __name__ == '__main__':
"""
minty, lumen, sandstone, yeti, pulse, united, morph, journal, darkly, superhero, solar
cyborg, vapor, simplex, cerculean,
"""
style = "morph" style = "morph"
root = Window(themename=style) root = Window(themename=style)
screenwidth = root.winfo_screenwidth() screenwidth = root.winfo_screenwidth()
@ -305,11 +301,13 @@ if __name__ == '__main__':
"width": screenwidth * 0.83, "width": screenwidth * 0.83,
"height": screenheight * 0.85, "height": screenheight * 0.85,
} }
# 配置界面大小
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) # 禁止用户调整界面大小
app = StuSys_X4(root, root_attr) app = StuSys_X4(root, root_attr)
app.create_left_plate()
app.create_right_plate()
ttk.Style().configure("TButton", font="-size 18") ttk.Style().configure("TButton", font="-size 18")
root.mainloop() root.mainloop()

@ -279,6 +279,10 @@ if __name__ == '__main__':
minty, lumen, sandstone, yeti, pulse, united, morph, journal, darkly, superhero, solar minty, lumen, sandstone, yeti, pulse, united, morph, journal, darkly, superhero, solar
cyborg, vapor, simplex, cerculean, cyborg, vapor, simplex, cerculean,
""" """
from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GraphvizOutput
from pycallgraph2 import Config
from pycallgraph2 import GlobbingFilter
style = "morph" style = "morph"
root = Window(themename=style) root = Window(themename=style)
screenwidth = root.winfo_screenwidth() screenwidth = root.winfo_screenwidth()
@ -293,7 +297,15 @@ if __name__ == '__main__':
(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)
app = StuSys_X4(root, root_attr) output = GraphvizOutput()
output.output_file = "basic.png"
ttk.Style().configure("TButton", font="-size 18") config = Config()
config.trace_filter = GlobbingFilter(include=[
'StuSys_X4.*',
'FormElement.*',
'LoadElement.*',
])
with PyCallGraph(output=output, config=config):
app = StuSys_X4(root, root_attr)
ttk.Style().configure("TButton", font="-size 18")
root.mainloop() root.mainloop()

Loading…
Cancel
Save