You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.1 KiB

# from program import *
from ExecInstructWithAnim import *
from ExecInstructWithText import *
r = RightPanel()
run_ani = ExecInstructWithAnim()
run_text = ExecInstructWithText()
bw, bh = 150, 45
# 按钮1
bx1, by1 = 750, 30
Button1 = tk.Button(root, text='自动执行指令(仅寄存器)', background=GOLD, command=lambda: Program1(), state=NORMAL)
Button1.place(x=bx1, y=by1, width=bw, height=bh)
def Program1():
if run_text.play == 1 or run_ani.play == 1:
messagebox.showwarning('警告', '程序正在运行')
return
run_text.auto_display()
# 按钮2
bx2, by2 = 750, 90
Button2 = tk.Button(root, text='自动执行指令(带UI)', background=GOLD, command=lambda: Program2(), state=NORMAL)
Button2.place(x=bx2, y=by2, width=bw, height=bh)
def Program2():
if run_text.play == 1 or run_ani.play == 1:
messagebox.showwarning('警告', '程序正在运行')
return
run_ani.auto_display()
# 按钮3
bx2, by2 = 820, 150
WR = tk.Button(root, text='装载程序', background=RED, command=lambda: r.write_memory(), state=NORMAL)
WR.place(x=bx2, y=by2, width=80, height=bh)
def main():
# 右键菜单
def onRightButtonUp(event):
menu.post(event.x_root, event.y_root)
menu = tk.Menu(root, tearoff=0)
menu.add_command(label='运算器', command=lambda: r.CAL_display())
menu.add_command(label='控制器', command=lambda: r.SIG_display())
menu.add_command(label='存储器', command=lambda: r.MEM_display())
cv.bind('<ButtonRelease-3>', onRightButtonUp)
root.mainloop()
if __name__ == "__main__":
from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GraphvizOutput
from pycallgraph2 import Config
from pycallgraph2 import GlobbingFilter
output = GraphvizOutput(font_size=30)
output.output_file = "basic.png"
output.group_font_size = 40
config = Config()
config.trace_filter = GlobbingFilter(include=[
'RightPanel.*',
'ExecInstructWithAnim.*',
'ExecInstructWithText.*',
])
with PyCallGraph(output=output, config=config):
main()