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


Python Toplevel.focus_force方法代码示例

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


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

示例1: popup_window

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_force [as 别名]
    def popup_window( self, text, filename ) :
        top = Toplevel()
  
        info = LabelFrame(top, text=text )#"Group Information")
        info_text = Text(info,
                              width=50,
                              height=8,
                              #bg=projectBgColor,
                              #fg=projectFgColor,
                              font=("nimbus mono bold","11")
                             )
        
        def savefunc() :
            self.writepaste( filename, info_text ) 
        
        def loadfunc() :
            self.readpaste( filename, info_text ) 
        
        info_save_button = Button(info, 
                                  text="Save", 
                                  command = savefunc )
        info_load_button = Button(info,
                                  text="Load",
                                  command = loadfunc )

        #self.pairs_load_button.pack( side=BOTTOM, padx=5, pady=5 )
        #self.pairs_save_button.pack( side=BOTTOM, padx=5, pady=5 )

        info_load_button.grid( row=5, column=5, padx=10, pady=5 )
        info_save_button.grid( row=5, column=6, padx=10, pady=5 )
        info_text.grid(row=1,  rowspan=3, 
                       column=1,  columnspan=7,
                       padx=5, pady=5 )

        info.grid(row=7,column=0, columnspan=6, sticky=W, padx=20, pady=10 )
        top.focus_force()
开发者ID:felloumi,项目名称:Pipeliner,代码行数:38,代码来源:frame.py

示例2: popup_window_contrast

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_force [as 别名]

#.........这里部分代码省略.........
            print('Error:', 'Cannot process peakcall.tab file:')
            return
        
        top = Toplevel()
        info = LabelFrame(top, text=text )#"Group Information")
        
        print( groups )
        contrast_vars = []
        contrast_menus = []
        n = 0
        groups.insert(0, NA)
        for i in range( int((len(groups)-1)*(len(groups)-2)/2) ):
            n = n + 1
            v1, v2 = StringVar(), StringVar()
            contrast_vars.append( [v1, v2] )
            o1, o2 = OptionMenu(info, v1, *groups), OptionMenu(info, v2, *groups)
            contrast_menus.append( [o1, o2] )

            v1.set(NA)
            v2.set(NA)
            vslabel = Label(info, text="  VS  ")

            o1.grid( row=n, column=0, padx=4, pady=1 )
            o2.grid( row=n, column=2, padx=4, pady=1 )
            vslabel.grid( row=n, column=1, padx=4, pady=1 )

        def savefunc() :
            info_text = StringIO()
            for v1, v2 in contrast_vars :
                v1 = v1.get() if v1.get() != NA else ""
                v2 = v2.get() if v2.get() != NA else ""
                
                if v1 and v2 :
                    pass
                elif v1 or v2 :
                    showerror( 'Error', "None or Both columns should be selected!" )
                    return
                else:
                    continue
                    
                print( v1, v2, file=info_text, sep="\t" )
            
            fp = open( contrast_fn, 'w' )
            fp.write( info_text.getvalue() )
            fp.close()
                              
        
        def loadfunc() :
            #self.readpaste( filename, info_text ) 
            for i, l in enumerate(open( contrast_fn )) :
                v1, v2 = l.split('\t')
                v1 = v1.strip()
                v2 = v2.strip()
                
                if v1 :
                    try : assert v1 in groups
                    except :
                        showwarning('WARNING', 'Group name is not in the selection list!' )
                        print( 'v1:',v1 ) 
                        print( 'group:', groups )
                        continue
                
                if v2 :
                    try: assert v2 in groups
                    except :
                        showwarning('WARNING', 'Group name is not in the selection list!' )
                        print( 'v2:',v2 ) 
                        print( 'group:', groups )
                        continue
                
                contrast_vars[i][0].set(v1)
                contrast_vars[i][1].set(v2)
                
        
        def clearfunc() :
            for v1, v2 in contrast_vars :
                v1.set(NA)
                v2.set(NA)
                
        
        info_clear_button = Button(top, 
                                  text="Clear", 
                                  command = clearfunc )
        info_save_button = Button(top, 
                                  text="Save", 
                                  command = savefunc )
        info_load_button = Button(top,
                                  text="Load",
                                  command = loadfunc )

        #self.pairs_load_button.pack( side=BOTTOM, padx=5, pady=5 )
        #self.pairs_save_button.pack( side=BOTTOM, padx=5, pady=5 )

        info_clear_button.grid( row=5, column=3, padx=10, pady=5 )
        info_load_button.grid( row=5, column=4, padx=10, pady=5 )
        info_save_button.grid( row=5, column=5, padx=10, pady=5 )


        info.grid(row=7,column=0, columnspan=6, sticky=W, padx=20, pady=10 )
        top.focus_force()
开发者ID:felloumi,项目名称:Pipeliner,代码行数:104,代码来源:epigenomeseq.py

示例3: popup_window_peakinfo

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_force [as 别名]

#.........这里部分代码省略.........
        input_menus = [OptionMenu(info,var,*selections) for var in input_vars]
        group_menus = [OptionMenu(info,var,*groups) for var in group_vars]
        group_entries = [Entry(info, bd=2, width=8, textvariable=var) for var in group_vars]
        
        chiplabel = Label(info, text= "ChIP Names")
        inputlabel = Label(info, text="Input Names")
        grouplabel = Label(info, text="Group Names")
        
        chiplabel.grid( row = 0, column = 1, padx=4, pady=1)
        inputlabel.grid( row = 0, column = 2, padx=4, pady=1)
        grouplabel.grid( row = 0, column = 3, padx=4, pady=1 )
        
        
        for i, (chvar, invar) in enumerate(zip(chip_vars, input_vars)) :
            chvar.set(selections[0])
            invar.set(selections[0])
            
            chip_menus[i].grid( row = i+1, column = 1, padx=4, pady=1 )
            input_menus[i].grid( row = i+1, column = 2, padx=4, pady=1 )
            group_entries[i].grid( row = i+1, column = 3, padx=4, pady=1 )
            group_menus[i].grid( row = i+1, column = 4, padx=4, pady=1 )
        
        
        def savefunc() :
            info_text = StringIO()
            for v1, v2, v3 in zip( chip_vars, input_vars, group_vars ) :
                v1 = v1.get().strip() if v1.get().strip() != NA else ""
                
                if not v1 :
                    continue
                    
                v2 = v2.get().strip() if v2.get().strip() != NA else ""
                v3 = v3.get().strip() if v3.get().strip() != NA else ""
                
                if not v3 :
                    showerror( "Error", "Missing Replicate group name detected.\nReplicate group names should be given!" )
                    print( "Error", "Missing Replicate group name detected.\nReplicate group names should be given!" )
                    return
                    
                print( v1, v2, v3, file=info_text, sep="\t" )
            
            fp = open( filename, 'w' )
            fp.write( info_text.getvalue() )
            fp.close()
        
        def loadfunc() :
            if not exists(filename) :
                print( filename, 'does not exists!' )
                return
            
            for i, l in enumerate(open( filename )) :
                v1, v2, v3 = l.split('\t')
                
                if v1 :
                    try : assert v1 in selections
                    except :
                        showwarning('WARNING', 'ChIP name is not in the selection list!' )
                        print( 'v1:',v1 ) 
                        print( 'selection:', selection )
                        continue
                
                if v2 :
                    try: assert v2 in selections
                    except :
                        showwarning('WARNING', 'Input name is not in the selection list!' )
                        print( 'v2:',v2 ) 
                        print( 'selection:', selection )
                        return
                    
                chip_vars[i].set(v1.strip())
                input_vars[i].set(v2.strip())
                group_vars[i].set(v3.strip())
            
        def clearfunc() :
            for i, (chvar, invar, grvar) in enumerate(zip(chip_vars, input_vars, group_vars)) :
                chvar.set(selections[0])
                invar.set(selections[0])
                grvar.set('')
        
        info_clear_button = Button(top, 
                                  text="Clear", 
                                  command = clearfunc )
        
        info_save_button = Button(top, 
                                  text="Save", 
                                  command = savefunc )
        
        info_load_button = Button(top,
                                  text="Load",
                                  command = loadfunc )

        #self.pairs_load_button.pack( side=BOTTOM, padx=5, pady=5 )
        #self.pairs_save_button.pack( side=BOTTOM, padx=5, pady=5 )

        info_clear_button.grid( row=5, column=3, padx=10, pady=5 )
        info_load_button.grid( row=5, column=4, padx=10, pady=5 )
        info_save_button.grid( row=5, column=5, padx=10, pady=5 )

        info.grid(row=7,column=0, columnspan=6, sticky=W, padx=20, pady=10 )
        top.focus_force()
开发者ID:felloumi,项目名称:Pipeliner,代码行数:104,代码来源:epigenomeseq.py


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