本文整理汇总了Python中Graph.Graph.title方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.title方法的具体用法?Python Graph.title怎么用?Python Graph.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph.Graph
的用法示例。
在下文中一共展示了Graph.title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DevelopmentWindow
# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import title [as 别名]
class DevelopmentWindow():
def __init__(self):
self.worlds = []
## Set up worlds
fLocs1 = [(2,0),(-2,0),(0,2),(0,-2),(0,3),(0,-3),(3,0),(-3,0),(4,0),(-4,0),(0,4),(0,-4),(0,7),(7,0),(-7,0)]
fLocs2 = [(1,1),(2,2),(3,3),(4,4),(3,5),(2,6),(1,7),(0,8),(-2,6),(-4,4),(-6,2),(-8,0),(-5,0),(-2,-3),(-5,-5)]
fLocs3 = [(-2,2),(-1,0),(1,0),(-1,0),(2,-2),(3,5),(-5,5),(-8,8),(10,10),(-10,10),(10,-10),(0,-1),(0,-2),(0,-3),(0,-4)]
fLocs4 = [(random.random()*20 - 20.0/2., random.random()*20 - 20.0/2.) for i in xrange(20)]
fLocs5 = [(random.random()*20 - 20.0/2., random.random()*20 - 20.0/2.) for i in xrange(20)]
self.worlds.append([1,15,20,fLocs1])
self.worlds.append([1,15,20,fLocs2])
self.worlds.append([1,15,20,fLocs3])
self.worlds.append([1,20,20,fLocs4])
self.worlds.append([1,20,20,fLocs5])
#parameters
self.sP = SimParam.SimParam()
self.sP.setWorld(1,self.worlds[0][0],self.worlds[0][1],self.worlds[0][2],self.worlds[0][3]) #change first index to change default world
self.sP.setWorld(2,self.worlds[1][0],self.worlds[1][1],self.worlds[1][2],self.worlds[1][3])
self.sP.setWorld(3,self.worlds[2][0],self.worlds[2][1],self.worlds[2][2],self.worlds[2][3])
self.sP.setWorld(4,self.worlds[3][0],self.worlds[3][1],self.worlds[3][2],self.worlds[3][3])
self.sP.setWorld(5,self.worlds[4][0],self.worlds[4][1],self.worlds[4][2],self.worlds[4][3])
self.sP.setAnimParams(1,1,(0,0))
self.paused = True #paused?
self.lastTime = 0
self.sim_msps = 0
self.dis_t = 1 #the t being displayed
self.buff_t = 0
self.writeInterval = 100
self.simHistory = {} #this will fill with produced worlds from the simulations
self.simEngine = SimulationEngine.SimulationEngine()
self.developmentHistory = {}
self.layoutHist = 300 #y value holder for new aniimat config button placement
self.layoutList = [] # holds config/delete animat buttons and labels for any animats other than default
#intialize TK
self.root = tk.Tk()
self.root.title("Development Simulation")
self.canvas = tk.Canvas(self.root, width=1080, height=720)
self.canvas.pack()
#some general-purpose colors
self.colorWhite = "#ffffff"
self.colorGrey = "#dddddd"
self.colorBlack = "#000000"
self.colorLightBlue = "#ADD8E6"
self.colorBlue = "#0000ff"
self.colorRed = "#ff0000"
#file options
self.file_opt = options = {}
options['defaultextension'] = '.netsim'
options['filetypes'] = [('all files', '.*'), ('text files', '.txt'), ('Simulation Files', '.netsim')]
#options['initialdir'] = 'C:\\'
options['initialfile'] = '.netsim'
options['parent'] = self.root
options['title'] = 'Save Simulation As...'
#set up menu bar
menubar = tk.Menu(self.root)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label="Start Simulation", command=self.startSimulation)
filemenu.add_command(label="Save Current Development Simulation", command=self.saveCurrentSimulation)
filemenu.add_command(label="Load Development from File", command=self.loadSimulationFromFile)
filemenu.add_separator()
filemenu.add_command(label="Load Results from Evolutionary Algorithm",command=self.loadEvo)
filemenu.add_separator()
filemenu.add_command(label="Exit",command=self.root.destroy)
menubar.add_cascade(label="File", menu=filemenu)
speedmenu = tk.Menu(menubar, tearoff=0)
speedmenu.add_command(label="1ms", command=lambda:self.setWriteInterval(1))
speedmenu.add_command(label="25ms", command=lambda:self.setWriteInterval(25))
speedmenu.add_command(label="50ms", command=lambda:self.setWriteInterval(50))
speedmenu.add_command(label="100ms", command=lambda:self.setWriteInterval(100))
speedmenu.add_command(label="1s", command=lambda:self.setWriteInterval(1000))
speedmenu.add_command(label="Do not write")
speedmenu.invoke(3) #default write interval is 100
editmenu = tk.Menu(menubar, tearoff=0)
editmenu.add_command(label="Parameters",command = self.editParameters)
editmenu.add_cascade(label="Write Interval", menu=speedmenu)
menubar.add_cascade(label="Edit", menu=editmenu)
self.root.config(menu=menubar)
#Set up neuron graph and text log box and control bar
self.neuronGraph = Graph(self.root, [75, 75, 475, 475], [-1.1, 1.1, -1.1, 1.1])
self.neuronGraph.plotCircle((2, 2), (0, 0), self.colorWhite)
self.neuronGraph.title("Development")
self.neuronGraph.xlabel("XAXIS")
self.neuronGraph.ylabel("YAXIS")
self.neuronGraph.draw(self.canvas)
#Set up World Parameter Options
self.animNum_sv = tk.StringVar()
self.animNum_sv.set(str(self.sP.getAnimNum(1)))
self.foodNum_sv = tk.StringVar()
self.foodNum_sv.set(str(self.sP.getFoodNum(1)))
self.arenaSize_sv = tk.StringVar()
self.arenaSize_sv.set(str(self.sP.getWorldSize(1)))
title = tk.Label(self.root, text="Parameter Settings",font="bold",relief="ridge",padx=5,pady=5)
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import title [as 别名]
class GUIDriver:
def __init__(self,master,devWin,simParams):
self.sP = simParams
#some parameters
self.paused = False # whether simulation playback is paused
self.simRunning = True # whether simulation is running - so buffering to GUI
self.lastTime = 0 # the last time on the clock
self.sim_msps = 0 # how many simulated milliseconds pass per second in display: i.e., a value of 1000 means real-time - useful for animat moving, but too fast to see neural activity
self.dis_t = 1 #the time being currently displayed by the GUI
self.buff_t = 0 #the time buffered by the Simulation Engine
self.writeInterval = 25 # sets the interval between write states (in simulated ms);
self.simHistory = {} # dictionary of time: dynamic world state
self.tracked_data = collections.defaultdict(lambda: collections.defaultdict(lambda: collections.OrderedDict())) # not clear what this is; SH
self.TRACK_NEURAL_FIRINGS = "Neural Firings"
self.TRACK_ENERGY = "Energy"
self.TRACK_POS = "Position"
self.TRACK_LFP = "LFP" # probably should give this another name
self.tracked_types = []
self.simEngine = SimulationEngine() #constructs a Simulation Engine
self.world = 0 #placeholder for the World currently being displayed
self.devWin = devWin # development window is parent; use this to set up parameters
#some general-purpose colors
self.colorWhite = "#ffffff"
self.colorGrey = "#dddddd"
self.colorBlack = "#000000"
self.colorLightBlue = "#ADD8E6"
self.colorBlue = "#0000ff"
self.colorRed = "#ff0000"
self.colorGreen = "#00ff00"
#setting up Tk window
self.root = master # window passed in
self.root.title("Animat Simulation")
self.canvas = tk.Canvas(self.root, width=1280, height=720)
self.canvas.pack()
#set up file options to save simulations
self.file_opt = options = {}
options['defaultextension'] = '.sim'
options['filetypes'] = [('all files', '.*'), ('text files', '.txt'), ('Simulation Files', '.sim')]
#options['initialdir'] = 'C:\\'
options['initialfile'] = '.sim'
options['parent'] = self.root
options['title'] = 'Save Simulation As...'
#set up menu bar
self.menubar = tk.Menu(self.root)
filemenu = tk.Menu(self.menubar, tearoff=0)
filemenu.add_command(label="Save Current Simulation", command=self.saveCurrentSimulation)
filemenu.add_command(label="Load Simulation from File", command=self.loadSimulationFromFile)
filemenu.add_command(label="Calculate Benchmark", command=self.benchmark)
filemenu.add_separator()
filemenu.add_command(label="Exit",command=self.quit)
self.menubar.add_cascade(label="File", menu=filemenu)
speedmenu = tk.Menu(self.menubar, tearoff=0)
speedCheckVar = tk.IntVar()
speedmenu.add_radiobutton(label="1ms", variable = speedCheckVar, command=lambda:self.setWriteInterval(1))
speedmenu.add_radiobutton(label="25ms", variable = speedCheckVar, command=lambda:self.setWriteInterval(25))
speedmenu.add_radiobutton(label="50ms", variable = speedCheckVar, command=lambda:self.setWriteInterval(50))
speedmenu.add_radiobutton(label="100ms", variable = speedCheckVar, command=lambda:self.setWriteInterval(100))
speedmenu.add_radiobutton(label="1s", variable = speedCheckVar, command=lambda:self.setWriteInterval(1000))
speedmenu.add_radiobutton(label="Do not write", variable = speedCheckVar)
speedmenu.invoke(1) #default write interval is 100
worldmenu = tk.Menu(self.menubar, tearoff=0)
worldVar = tk.IntVar() #not used just required
worldmenu.add_radiobutton(label="World 1", variable = worldVar, command=lambda:self.setWorldNum(1))
worldmenu.add_radiobutton(label="World 2", variable = worldVar, command=lambda:self.setWorldNum(2))
worldmenu.add_radiobutton(label="World 3", variable = worldVar, command=lambda:self.setWorldNum(3))
worldmenu.add_radiobutton(label="World 4", variable = worldVar, command=lambda:self.setWorldNum(4))
worldmenu.add_radiobutton(label="World 5", variable = worldVar, command=lambda:self.setWorldNum(5))
speedmenu.invoke(self.sP.worldToRun-1) #default write interval is 25
editmenu = tk.Menu(self.menubar, tearoff=0)
editmenu.add_cascade(label="Write Interval", menu=speedmenu)
editmenu.add_cascade(label="World to Run", menu=worldmenu)
editmenu.add_command(label="Parameters", command=self.showDevWin)
self.menubar.add_cascade(label="Edit", menu=editmenu)
trackmenu = tk.Menu(self.menubar, tearoff=0)
trackmenu.add_checkbutton(label="Neural Firings", command = lambda:self.track(self.TRACK_NEURAL_FIRINGS))
trackmenu.add_checkbutton(label="Energy", command = lambda:self.track(self.TRACK_ENERGY))
trackmenu.add_checkbutton(label="Position", command = lambda:self.track(self.TRACK_POS))
trackmenu.add_checkbutton(label="LFP", command = lambda:self.track(self.TRACK_LFP))
trackmenu.invoke(0)
trackmenu.invoke(1)
trackmenu.invoke(2)
trackmenu.invoke(3)
self.menubar.add_cascade(label="Track", menu = trackmenu)
viewMenu = tk.Menu(self.menubar, tearoff=0)
viewMenu.add_command(label="Internal Variables",command=self.varViewer)
viewMenu.add_command(label="Connection Viewer",command=self.connectionViewer)
self.menubar.add_cascade(label="View",menu=viewMenu)
debugMenu = tk.Menu(self.menubar, tearoff=0)
debugMenu.add_command(label="Print S",command = self.printS)
debugMenu.add_command(label="Print RL",command = self.printRL)
self.menubar.add_cascade(label="Debug",menu=debugMenu)
self.root.config(menu=self.menubar)
#.........这里部分代码省略.........