本文整理汇总了Python中interface.Interface.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.setup方法的具体用法?Python Interface.setup怎么用?Python Interface.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.Interface
的用法示例。
在下文中一共展示了Interface.setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Interface
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import setup [as 别名]
# Return immediately if this is being imported in another module.
if __name__ == "__main__":
# Run in a different process.
if os.fork():
sys.exit()
# Instantiate the main interface object.
main = Interface()
# Create the other components of the interface...
display = Display(main)
controls = Controls(main)
simulation = Simulation(main)
# ...and add a set of slider controls to it.
electronMass= 9.10938188e-31 # Kg
c = 299792458
width = Parameter("Width of slits", 1e-50, 1e-12)
distance = Parameter("Distance between slits", 1e-50, 10e-12)
mass = Parameter("Particle mass", 0.01*electronMass, 10*electronMass, electronMass)
velocity = Parameter("Particle velocity", 0, c, 0.9*c)
current = Parameter("Current in solenoid", -10, 10, 0)
controls.add(width, distance, mass, velocity, current)
# Hook up the interface components and begin the event loop.
main.setup(display, controls, simulation)
main.start()