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


Python Toplevel.transient方法代码示例

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


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

示例1: ListDialog

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import transient [as 别名]
class ListDialog(object):
    def __init__ (self, master, items, message, accept_func):
        self.accept_func = accept_func

        self.top = Toplevel(master)
        self.top.transient(master)
        self.top.rowconfigure(0, weight=1)
        self.top.rowconfigure(1, weight=3)
        self.top.rowconfigure(2, weight=0)
        self.top.columnconfigure(0, weight=1)
        self.top.columnconfigure(1, weight=1)
        self.top.resizable(width=True, height=True)

        self.frame = Frame(self.top)
        self.frame.rowconfigure(0, weight=1)
        self.frame.rowconfigure(1, weight=0)
        self.frame.columnconfigure(0, weight=1)
        self.frame.columnconfigure(1, weight=0)
        self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2)
        self.canvas = Canvas(self.frame)
        self.canvas.create_text(0, 0, text=message, anchor=NW)
        self.canvas.grid(row=0, column=0, sticky=(N, W, S, E))

        self.vscroll = Scrollbar(self.frame, command=self.canvas.yview)
        self.vscroll.grid(row=0, column=1, sticky=(N, S))
        self.canvas['yscrollcommand'] = self.vscroll.set

        self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL)
        self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2)
        self.canvas['xscrollcommand'] = self.hscroll.set

        self.canvas['scrollregion'] = self.canvas.bbox('all')
        self.canvas.bind('<Button-4>', self.scroll)
        self.canvas.bind('<Button-5>', self.scroll)
        self.canvas.bind('<MouseWheel>', self.scroll)

        self.view = NameView(self.top, sorted(items))
        self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S))

        self.delbutton = Button(self.top, text='Ok', command=self.accept )
        self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel)
        self.delbutton.grid(row=2, column=0)
        self.cancelbutton.grid(row=2, column=1)
        self.view.widget.focus_set()

    def accept(self):
        self.accept_func(self.view.selection())
        self.top.destroy()

    def cancel(self):
        self.result = None
        self.top.destroy()

    def scroll(self, event):
        if event.num == 4 or event.delta > 0:
            self.canvas.yview(SCROLL, -1, UNITS)
        elif event.num == 5 or event.delta < 0:
            self.canvas.yview(SCROLL, 1, UNITS)
开发者ID:gokai,项目名称:tim,代码行数:60,代码来源:dialog.py

示例2: on_post_merge_sql

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

示例3: __init__

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

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

示例5: show_stat

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import transient [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.transient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。