本文整理汇总了Python中program.Program.load_file方法的典型用法代码示例。如果您正苦于以下问题:Python Program.load_file方法的具体用法?Python Program.load_file怎么用?Python Program.load_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类program.Program
的用法示例。
在下文中一共展示了Program.load_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load_file [as 别名]
def main():
root = tkinter.Tk()
from libs import painter
#import pdb;pdb.set_trace()
program = Program(painter)
try:
fileToLoad = sys.argv[1]
except IndexError:
print("Ne file specified, opening first.lsa")
fileToLoad = "first.lsa"
program.load_file(fileToLoad)
#Create the gui widgets
menuBar = gui.MenuBar(root, program)
stepChanger = gui.StepChanger(root, program)
text = gui.TextInput(root, program)
contextShower = painter.ContextShower(root)
activeStateShower = gui.ActiveStateShower(root, program, contextShower)
stepOutput = gui.StepOutput(root, text, program)
textHelp = gui.TextHelp(root, text, program)
help = gui.HelpShower(root, program)
#Place them in the rigth order
root['menu'] = menuBar
root.grid_propagate(True)
stepChanger.grid(row=0, column=0, columnspan=50, sticky="nesw")
vScrollbar = tkinter.Scrollbar(root, orient=tkinter.VERTICAL)
vScrollbar.grid(row=1, column=0, sticky="nesw")
text.grid(row=1, column=10, sticky="nesw")
textHelp.grid(row=1, column=11, sticky="nesw")
stepOutput.grid(row=1, column=12, sticky="nesw")
activeStateShower.grid(row=1, column=13, sticky="nesw")
help.grid(row=2, column=0, columnspan=50, sticky="nesw")
root.columnconfigure(0, weight=0)
root.columnconfigure(10, weight=2)
root.columnconfigure(11, weight=1)
root.columnconfigure(12, weight=2)
root.columnconfigure(13, weight=0)
root.rowconfigure(0, weight=0)
root.rowconfigure(1, weight=1)
root.rowconfigure(2, weight=0)
def proxy_yview(*args, **kwords):
text.yview(*args, **kwords)
textHelp.on_activeStep_changed()
stepOutput.on_steps_changed()
def proxy_set(*args, **kwords):
vScrollbar.set(*args, **kwords)
textHelp.on_activeStep_changed()
stepOutput.on_steps_changed()
text['yscrollcommand'] = proxy_set
vScrollbar['command'] = proxy_yview
# create the interpretor and go, go, go
interpretor = interpreter.Interpreter(program)
root.after(500, lambda : program.event("source_changed")())
root.mainloop()