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


Python Toplevel.grab_set方法代码示例

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


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

示例1: on_post_merge_sql

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_set [as 别名]
 def on_post_merge_sql(self, *args):
     # Show post-merge-SQL dialog
     _wdw = Toplevel()
     _wdw.geometry('+400+400')
     _wdw.e = TextExtension(_wdw, textvariable=self.post_execute_sql)
     _wdw.e.pack()
     _wdw.e.focus_set()
     _wdw.transient(self.parent)
     _wdw.grab_set()
     self.parent.wait_window(_wdw)
     _wdw.e.unhook()
     del (_wdw)
开发者ID:OptimalBPM,项目名称:qal,代码行数:14,代码来源:main_tk_replicator.py

示例2: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_set [as 别名]
class SpeciesListDialog:
    def __init__(self, parent):
        self.parent = parent
        self.gui = Toplevel(parent.guiRoot)
        self.gui.grab_set()
        self.gui.focus()

        self.gui.columnconfigure(0, weight=1)
        self.gui.rowconfigure(1, weight=1)

        Label(self.gui, text="Registered Species:").grid(row=0, column=0, pady=5, padx=5, sticky="w")
        self.listRegisteredSpecies = Listbox(self.gui, width=70)
        self.buttonAdd = Button(self.gui, text=" + ")
        self.buttonDel = Button(self.gui, text=" - ")
        self.listRegisteredSpecies.grid(row=1, column=0, columnspan=3, sticky="nswe", pady=5, padx=5)
        self.buttonAdd.grid(row=2, column=1, pady=5, padx=5)
        self.buttonDel.grid(row=2, column=2, pady=5, padx=5)

        # Set (minimum + max) Window size
        self.gui.update()
        self.gui.minsize(self.gui.winfo_width(), self.gui.winfo_height())
        #         self.gui.maxsize(self.gui.winfo_width(), self.gui.winfo_height())

        self.actionUpdate(None)
        self.gui.bind("<<Update>>", self.actionUpdate)
        self.gui.protocol("WM_DELETE_WINDOW", self.actionClose)

        self.buttonDel.bind("<ButtonRelease>", self.actionDel)
        self.buttonAdd.bind("<ButtonRelease>", self.actionAdd)

        self.gui.mainloop()

    def actionClose(self):
        self.parent.guiRoot.event_generate("<<Update>>", when="tail")
        self.gui.destroy()

    def actionUpdate(self, event):
        self.listRegisteredSpecies.delete(0, "end")
        for (taxid, name) in self.parent.optimizer.speciesList:
            self.listRegisteredSpecies.insert("end", taxid + ": " + name)

    def actionDel(self, event):
        try:
            selection = self.listRegisteredSpecies.selection_get()
            selectionSplit = selection.split(": ")
            self.parent.optimizer.speciesList.remove((selectionSplit[0], selectionSplit[1]))
            self.gui.event_generate("<<Update>>")
        except tkinter.TclError:
            # no selection
            pass

    def actionAdd(self, Event):
        SpeciesSearchDialog(self.parent, self)
开发者ID:hoerldavid,项目名称:codonoptimizer,代码行数:55,代码来源:OptimizerMainWindow.py

示例3: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_set [as 别名]
 def __init__(self, root):
     top = Toplevel(master = root)
     top.title('Create a new HDF Datastore')
     frames = {'SelectFilename'     : 0,
               'SelectDatasetTypes' : 1,
               'SelectSearchPath'   : 2,
               'SelectParser'       : 3,
               'Options'            : 4,
               'BuildButton'        : 5}
     Grid.rowconfigure(top, frames['SelectDatasetTypes'], weight = 1)
     Grid.rowconfigure(top, frames['BuildButton'],        weight = 0)
     Grid.columnconfigure(top, 0, weight=1)
 
     # Select filename and path    
     f = self.Frame_SelectFilename(
         master = top, padx = 5, pady = 5,
         text = 'Path and filename for the new datastore')
     f.grid(row = frames['SelectFilename'], sticky = E+W)
     
     # Select dataset types
     t = self.Frame_SelectDatasetTypes(
         master = top, padx = 5, pady = 5,
         text = 'Select dataset types and configure the file reader')
     t.grid(row = frames['SelectDatasetTypes'], sticky = N+S+E+W)
     
     # Select search path
     s = self.Frame_SelectSearchPath(
         master = top, padx = 5, pady = 5,
         text = 'Directory containing input data files')
     s.grid(row = frames['SelectSearchPath'], sticky = E+W)
     
     # Select parser
     p = self.Frame_SelectParser(
         master = top, padx = 5, pady = 5,
         text = 'Select and configure the filename parser')
     p.grid(row = frames['SelectParser'], sticky = E+W)
     
     # Optional arguments for readingFromFiles
     o = self.Frame_SelectOptions(
         master = top, padx = 5, pady = 5,
         text = 'Miscellaneous build options')
     o.grid(row = frames['Options'], sticky = E+W)
     
     frameParams = (f, t, s, p, o)
     build = Button(
         master = top, text = 'Build',
         command=lambda: self._buildDatabase(self, top, frameParams))
     build.grid(row = frames['BuildButton'])
     
     # Make this window modal
     top.transient(root)
     top.grab_set()
     root.wait_window(top)
开发者ID:kmdouglass,项目名称:bstore,代码行数:55,代码来源:_createdatastore.py

示例4: askgridprop

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_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

示例5: _license

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_set [as 别名]
    def _license(self):
        """ affiche la licence dans une nouvelle fenêtre """
        def close():
            """ ferme la fenêtre """
            self.focus_set()
            fen.destroy()

        fen = Toplevel(self)
        fen.title(_("License"))
        fen.transient(self)
        fen.protocol("WM_DELETE_WINDOW", close)
        fen.resizable(0, 0)
        fen.grab_set()
#        set_icon(fen)
        texte = Text(fen, width=50, height=18)
        texte.pack()
        texte.insert("end",
                     _("Sudoku-Tk is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\n"))
        texte.insert("end",
                     _("Sudoku-Tk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n"))
        texte.insert("end",
                     _("You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/."))

        i = int(texte.index("5.end").split(".")[1])
        texte.tag_add("link", "5.%i" % (i - 29), "5.%i" % (i - 1))
        texte.tag_configure("link", foreground="#0000ff", underline=1)
        texte.tag_bind("link", "<Button - 1>",
                       lambda event: webOpen("http://www.gnu.org/licenses/"))
        texte.tag_bind("link", "<Enter>",
                       lambda event: texte.config(cursor="hand1"))
        texte.tag_bind("link",
                       "<Leave>", lambda event: texte.config(cursor=""))
        texte.configure(state="disabled", wrap="word")

        b_close = Button(fen, text=_("Close"), command=close)
        b_close.pack(side="bottom")
        b_close.focus_set()
        fen.wait_window(fen)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:40,代码来源:about.py

示例6: ask_class_name

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_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

示例7: askSpan

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_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

示例8: show_stat

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import grab_set [as 别名]
    def show_stat(self):
        """ show best times """
        def reset():
            """ reset best times """
            for level in ["easy", "medium", "difficult"]:
                CONFIG.set("Statistics", level, "")
            top.destroy()

        if self.chrono_on:
            self.play_pause()
        top = Toplevel(self)
        top.transient(self)
        top.columnconfigure(1, weight=1)
        top.resizable(0, 0)

        top.title(_("Statistics"))
        top.grab_set()

        Label(top, text=_("Best times"), font="Sans 12 bold").grid(row=0, columnspan=2,
                                                                   padx=30, pady=10)

        for i, level in enumerate(["easy", "medium", "difficult"]):
            Label(top, text=_(level.capitalize()),
                  font="Sans 10 bold").grid(row=i + 1, column=0, padx=(20, 4),
                                            pady=4, sticky="e")
            tps = CONFIG.get("Statistics", level)
            if tps:
                tps = int(tps)
                m = tps // 60
                s = tps % 60
                Label(top, text=" %i min %i s" % (m, s),
                      font="Sans 10").grid(row=i + 1, column=1,
                                           sticky="w", pady=4,
                                           padx=(4, 20))
        Button(top, text=_("Close"), command=top.destroy).grid(row=4, column=0, padx=(10, 4), pady=10)
        Button(top, text=_("Clear"), command=reset).grid(row=4, column=1, padx=(4, 10), pady=10)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:38,代码来源:sudoku.py


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