本文整理汇总了Python中Tkinter.Frame.focus_set方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.focus_set方法的具体用法?Python Frame.focus_set怎么用?Python Frame.focus_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Frame
的用法示例。
在下文中一共展示了Frame.focus_set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import focus_set [as 别名]
def __init__(self,img_names):
#class SortDisplay(Canvas):
# def __init__(self, master,img_names,zoom_width,zoom_height,
# keep_dir,delete_dir):
Frame.__init__(self)
self.pack(expand=YES, fill=BOTH)
self.master.title('CryoEM Image Display')
self.master.iconname('CDISP')
self.focus_set()
self.name_list = NameList(img_names)
iter_frame = Frame(self)
iter_frame.pack(side=TOP, expand=NO, fill=BOTH)
iter_frame.focus_set()
self.prev_button = IterButton(iter_frame, text='<')
self.prev_button.pack(side=LEFT,expand=NO,fill=BOTH)
self.prev_button.bind('<Button-1>', self.display_prev_image)
self.next_button = IterButton(iter_frame, text='>')
self.next_button.pack(side=LEFT,expand=NO,fill=BOTH)
self.next_button.bind('<Button-1>', self.display_next_image)
self.resize_buttonmx = IterButton(iter_frame, text='-')
self.resize_buttonmx.pack(side=LEFT,expand=NO,fill=BOTH)
self.resize_buttonpx = IterButton(iter_frame, text='+')
self.resize_buttonpx.pack(side=LEFT,expand=NO,fill=BOTH)
self.quit_button = IterButton(iter_frame,text='Quit',command=self.quit)
self.quit_button.pack(side=LEFT,expand=NO, fill=BOTH)
self.filler = IterButton(iter_frame,relief=FLAT,overrelief=FLAT)
filler_background = self.filler.cget("background")
self.filler.configure(activebackground=filler_background)
# uncomment to look at the keys available in a button
# for key in self.filler.keys(): print key, '=', self.filler.cget(key)
self.filler.pack(side=LEFT,expand=YES, fill=BOTH)
self.canvas = self.create_canvas()
self.display_current_image()
self.resize_buttonmx.bind('<Button-1>',
func=lambda x: self.canvas.resize_image(-1))
self.resize_buttonpx.bind('<Button-1>',
func=lambda x: self.canvas.resize_image(1))
self.canvas.bind('+', func=lambda x: self.canvas.resize_image(1))
self.canvas.bind('-', func=lambda x: self.canvas.resize_image(-1))