Esempio n. 1
0
        print 'Here!'
        return cvsMap  # will it get here?
        pass
    #end of def
#end of class

class MyDialog:                                                                         # 定义对话框类
        def __init__(self, root,i,j):                                                   # 对话框初始化
                self.top = Tkinter.Toplevel(root)                                       # 生成Toplevel组件
                label = Tkinter.Label(self.top, text='Please Input tower for %d,%d'%(i,j))                    # 生成标签组件
                label.pack()
                self.entry = Tkinter.Entry(self.top)                                    # 生成文本框组件
                self.entry.pack()
                self.entry.focus()                                                      # 让文本框获得焦点
                btn = Tkinter.Button(self.top, text='Ok',                               # 生成按钮
                                        command=self.Ok)                                # 设置按钮事件处理函数
                self.top.bind('<Return>',lambda e:self.Ok(),'+')
                self.top.geometry('300x100+500+200')     
                btn.pack()
        def Ok(self):                                                                   # 定义按钮事件处理函数
                self.input = self.entry.get()                                           # 获取文本框中内容,保存为input
                self.top.destroy()                                                      # 销毁对话框
        def get(self):                                                                  # 返回在文本框输入的内容
                return self.input


if __name__ == '__main__':
    from solve import readMapInput
    s = int(raw_input())
    cvsMap,l = readMapInput()    
    cvsBoard(cvsMap,10).mainloop()
Esempio n. 2
0
    # for datum in fitness_history:
    # print datum
    # print 'Besti:',para.gbInd
    # print 'Bests:',para.gbScore

    # plotMap(para, para.gbInd)
    return para


if __name__ == "__main__":
    from solve import readMapInput

    bestscore = -999
    besti = None
    s = int(raw_input())
    mapData, l = readMapInput()
    res = []
    for g in mapData.gli:
        for i in xrange(10):
            para = getLayout(mapData, g)
            if para.gbScore > bestscore:
                bestscore = para.gbScore
                besti = copy.deepcopy(para.gbInd)
                print "change:"
                print "Besti:", para.gbInd
                print "Bests:", para.gbScore
                plotMap(para, besti)
    print "Last", bestscore
    print besti

    plotMap(para, besti)