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


Python Toplevel.focus_set方法代码示例

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


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

示例1: _object_browser

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
def _object_browser(parent):  # htest #
    import sys
    from tkinter import Toplevel
    top = Toplevel(parent)
    top.title("Test debug object browser")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    top.geometry("+%d+%d"%(x + 100, y + 175))
    top.configure(bd=0, bg="yellow")
    top.focus_set()
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = make_objecttreeitem("sys", sys)
    node = TreeNode(sc.canvas, None, item)
    node.update()
开发者ID:CabbageHead-360,项目名称:cpython,代码行数:16,代码来源:debugobj.py

示例2: askgridprop

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
        def askgridprop():
            win = Toplevel()
            color = ['#000000', '#000000']

            propvars = [StringVar() for i in range(4)]
            guidata = (
                {
                    'linestyle': ('Major Line Style', propvars[0], None),
                    'linewidth': ('Major Line Width', propvars[1], check_nonnegative_float)
                },
                {
                    'linestyle': ('Minor Line Style', propvars[2], None),
                    'linewidth': ('Minor Line Width', propvars[3], check_nonnegative_float)
                }
            )

            for d in guidata:
                for key in d:
                    pitem = LabeledEntry(win)
                    pitem.pack()
                    pitem.label_text = d[key][0]
                    pitem.entry['textvariable'] = d[key][1]
                    if d[key][2]:
                        pitem.checker_function = d[key][2]

            def setmajorcolor():
                c = askcolor()
                color[0] = c[1]

            def setminorcolor():
                c = askcolor()
                color[1] = c[1]
                
            Button(win, text='Major Line Color', command=setmajorcolor).pack()
            Button(win, text='Minor Line Color', command=setminorcolor).pack()

            win.protocol('WM_DELETE_WINDOW', win.quit)
            win.focus_set()
            win.grab_set()
            win.mainloop()
            win.destroy()
            
            c_major = StringVar(); c_major.set(color[0])
            c_minor = StringVar(); c_minor.set(color[1])
            guidata[0]['color'] = ('Major Line Color', c_major, None)
            guidata[1]['color'] = ('Minor Line Color', c_minor, None)
            return guidata
开发者ID:xialulee,项目名称:WaveSyn,代码行数:49,代码来源:figurewindow.py

示例3: _dyn_option_menu

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
def _dyn_option_menu(parent):  # htest #
    from tkinter import Toplevel

    top = Toplevel()
    top.title("Tets dynamic option menu")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    top.focus_set()

    var = StringVar(top)
    var.set("Old option set") #Set the default value
    dyn = DynOptionMenu(top,var, "old1","old2","old3","old4")
    dyn.pack()

    def update():
        dyn.SetMenu(["new1","new2","new3","new4"], value="new option set")
    button = Button(top, text="Change option set", command=update)
    button.pack()
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:20,代码来源:dynOptionMenuWidget.py

示例4: _dyn_option_menu

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
def _dyn_option_menu(parent):  # htest #
    from tkinter import Toplevel # + StringVar, Button

    top = Toplevel(parent)
    top.title("Tets dynamic option menu")
    x, y = map(int, parent.geometry().split('+')[1:])
    top.geometry("200x100+%d+%d" % (x + 250, y + 175))
    top.focus_set()

    var = StringVar(top)
    var.set("Old option set") #Set the default value
    dyn = DynOptionMenu(top,var, "old1","old2","old3","old4")
    dyn.pack()

    def update():
        dyn.SetMenu(["new1","new2","new3","new4"], value="new option set")
    button = Button(top, text="Change option set", command=update)
    button.pack()
开发者ID:Darkness0ut,项目名称:cpython,代码行数:20,代码来源:dynoption.py

示例5: ask_class_name

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
def ask_class_name():
    win = Toplevel()
    
    module_name  = StringVar()
    class_name   = StringVar()
    
    module_item  = LabeledEntry(win)
    module_item.label_text    = 'Module Name'
    module_item.pack()
    module_item.entry_variable     = module_name
    
    class_item   = LabeledEntry(win)
    class_item.label_text     = 'Class Name'
    class_item.pack()
    class_item.entry_variable      = class_name
    
    Button(win, text='OK', command=win.quit).pack()

    win.protocol('WM_DELETE_WINDOW', win.quit)
    win.focus_set()
    win.grab_set()
    win.mainloop()
    win.destroy()
    return module_name.get(), class_name.get()
开发者ID:xialulee,项目名称:WaveSyn,代码行数:26,代码来源:figurewindow.py

示例6: askSpan

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import focus_set [as 别名]
 def askSpan(orient='v'):
     win = Toplevel()
     pxmin = LabeledEntry(win)
     pxmin.pack()
     pxmin.label_text = 'xmin' if orient=='v' else 'ymin'
     pxmax = LabeledEntry(win)
     pxmax.pack()
     pxmax.label_text = 'xmax' if orient=='v' else 'ymax'
     def formatter(val):
         val = float(val)
         val /= 100.
         return '{0:0.2f}'.format(val)
     alphaScale = LabeledScale(win, from_=0, to=100, name='alpha', formatter=formatter)
     alphaScale.set(50.0)
     alphaScale.pack()
     win.protocol('WM_DELETE_WINDOW', win.quit)
     win.focus_set()
     win.grab_set()
     win.mainloop()
     xmin    = pxmin.entry.get()
     xmax    = pxmax.entry.get()
     alpha   = alphaScale.get() / 100.
     win.destroy()
     return map(float, (xmin, xmax, alpha))
开发者ID:xialulee,项目名称:WaveSyn,代码行数:26,代码来源:figurewindow.py


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