当前位置: 首页>>代码示例>>Python>>正文


Python NotePad.destroy方法代码示例

本文整理汇总了Python中xbb_utils.NotePad.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python NotePad.destroy方法的具体用法?Python NotePad.destroy怎么用?Python NotePad.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbb_utils.NotePad的用法示例。


在下文中一共展示了NotePad.destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from xbb_utils import NotePad [as 别名]
# 或者: from xbb_utils.NotePad import destroy [as 别名]

#.........这里部分代码省略.........
                                scrolledlist_items=self.nin + self.pin,
                                selectioncommand=self.Validate
                                )
        self.blasts = Pmw.ComboBox(self.cf,
                                   label_text='Blast Programs:',
                                   labelpos='nw',
                                   scrolledlist_items=['blastn', 'blastp', 'blastx', 'tblastn', 'tblastx'],
                                   selectioncommand=self.Validate
                                   )
        self.dbs.pack(side=LEFT, expand=1, fill=X)
        self.blasts.pack(side=LEFT, expand=1, fill=X)

        self.alternative_f = Frame(self.cf)
        self.alternative = Entry(self.alternative_f)
        self.alternative_f.pack(side=TOP, fill=X, expand=1)
        self.alternative.pack(side=LEFT, fill=X, expand=1)
        self.ok = Button(self.alternative_f, text='Run',
                         command=self._Run)
        self.ok.pack(side=RIGHT)

        self.dbs.selectitem(0)
        self.blasts.selectitem(0)
        self.Validate()

    def Validate(self, *args):
        db = self.dbs.get()
        prog = self.blasts.get()
        color = 'red'
        if (prog in ['blastn', 'tblastx', 'tblastn']) == (db in self.nin):
            color = 'green'
        elif (prog in ['blastp', 'blastx']) == (db in self.pin):
            color = 'green'

        self.dbs.component('entry').configure(bg=color)
        self.blasts.component('entry').configure(bg=color)

    def _Run(self):
        alternative_command = self.alternative.get()
        if len(alternative_command.strip()):
            self.command = alternative_command.strip()
        else:
            db = self.dbs.get()
            prog = self.blasts.get()
            self.command = 'echo %s | nice blastall -d %s -p %s' % (self.seq, db, prog)

        self.Run()

    def Update(self):
        self.notepad.update()
        self.notepad.after(1, self.Update)

    def oldRun(self):
        self.notepad = NotePad()
        self.notepad.menubar.configure(bg='red')
        self.notepad.bind('<Destroy>', self.Exit)

        self.Update()

        print(self.command)
        self.pipe = os.popen(self.command)
        while True:
            try:
                char = self.pipe.read(1)
                self.notepad.insert(END, char)
                self.notepad.update()
            except:
                break
            if not char:
                break

        try:
            self.notepad.menubar.configure(bg='green')
        except:
            pass

    def Run(self):
        self.notepad = NotePad()
        tid = self.notepad.tid
        self.notepad.menubar.configure(bg='red')

        self.toplevel.destroy()
        blastbg = xbb_blastbg.BlastDisplayer(self.command, tid)
        blastbg.RunCommand()

        # indicate the finished run by changing color
        try:
            self.notepad.menubar.configure(bg='green4')
        except:
            pass

    def Exit(self, *args):

        try:
            self.pipe.close()
            del(self.pipe)
        except:
            pass
        self.notepad.destroy()

        sys.exit(0)
开发者ID:tcyb,项目名称:biopython,代码行数:104,代码来源:xbb_blast.py


注:本文中的xbb_utils.NotePad.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。