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


Python Toplevel.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
 def __init__(self, parent, case, val_ou_pos, **options):
     """ créer le Toplevel 'À propos de Bracelet Generator' """
     Toplevel.__init__(self, parent, **options)
     self.withdraw()
     self.type = val_ou_pos  # clavier pour rentrer une valeur ou une possibilité
     self.overrideredirect(True)
     self.case = case
     self.transient(self.master)
     self.style = Style(self)
     self.style.configure("clavier.TButton", font="Arial 12")
     self.boutons = [[Button(self, text="1", width=2, style="clavier.TButton", command=lambda: self.entre_nb(1)),
                      Button(self, text="2", width=2, style="clavier.TButton", command=lambda: self.entre_nb(2)),
                      Button(self, text="3", width=2, style="clavier.TButton", command=lambda: self.entre_nb(3))],
                     [Button(self, text="4", width=2, style="clavier.TButton", command=lambda: self.entre_nb(4)),
                      Button(self, text="5", width=2, style="clavier.TButton", command=lambda: self.entre_nb(5)),
                      Button(self, text="6", width=2, style="clavier.TButton", command=lambda: self.entre_nb(6))],
                     [Button(self, text="7", width=2, style="clavier.TButton", command=lambda: self.entre_nb(7)),
                      Button(self, text="8", width=2, style="clavier.TButton", command=lambda: self.entre_nb(8)),
                      Button(self, text="9", width=2, style="clavier.TButton", command=lambda: self.entre_nb(9))]]
     for i in range(3):
         for j in range(3):
             self.boutons[i][j].grid(row=i, column=j)
     self.protocol("WM_DELETE_WINDOW", self.quitter)
     self.resizable(0, 0)
     self.attributes("-topmost", 0)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:27,代码来源:clavier.py

示例2: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
 def __init__(self, parent, filename, title):
     Toplevel.__init__(self, parent)
     self.wm_title(title)
     self.protocol("WM_DELETE_WINDOW", self.destroy)
     HelpFrame(self, filename).grid(column=0, row=0, sticky='nsew')
     self.grid_columnconfigure(0, weight=1)
     self.grid_rowconfigure(0, weight=1)
开发者ID:whqkdhfh13,项目名称:sswp,代码行数:9,代码来源:help.py

示例3: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, parent, title=None):
        Toplevel.__init__(self, parent)
        self.transient(parent)

        if title:
            self.title(title)

        self.parent = parent
        self.result = None

        body = Frame(self)
        self.initial_focus = self.body(body)
        body.pack(padx=5, pady=5)
        self.buttonbox()
        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)
        self.geometry("+%d+%d" % (parent.winfo_rootx() + 50,
                                  parent.winfo_rooty() + 50))
        self.initial_focus.focus_set()

        self.wait_window(self)
开发者ID:SpeedProg,项目名称:PveLauncher,代码行数:27,代码来源:tksimpledialog.py

示例4: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, master, text, *args, **kwargs):
        self.master = master
        Toplevel.__init__(self, master, *args, **kwargs)

        # Setup text box.
        self.text = Text(self, width=60, height=20, wrap=NONE)
        self.text.insert("1.0", text)
        self.text["state"] = "disabled"
        self.text.grid(row=0, column=0, sticky="NESW")

        # Create a vertical scrollbar.
        scrolly = Scrollbar(self, orient="vertical",
                            command=self.text.yview)
        scrolly.grid(row=0, column=1, sticky="NS")

        # Create a horizontal scrollbar.
        scrollx = Scrollbar(self, orient="horizontal",
                            command=self.text.xview)
        scrollx.grid(row=1, column=0, columnspan=2, sticky="EW")

        # Add the scroll bars.
        self.text.configure(yscrollcommand=scrolly.set,
                            xscrollcommand=scrollx.set)

        # Setup special configurings.
        self.transient(master)
        self.protocol("WM_DELETE_WINDOW", self.cancel)
        self.grab_set()
        self.focus_set()
        self.wait_window(self)
开发者ID:I8087,项目名称:GratiotIDE,代码行数:32,代码来源:Error.py

示例5: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, master, **options):
        """ créer le Toplevel 'À propos de Sudoku-Tk' """
        Toplevel.__init__(self, master, class_="Sudoku-Tk", **options)

        self.title(_("About Sudoku-Tk"))
        self.transient(master)
        self.grab_set()
#        set_icon(self)
        self.image = open_image(ICONE_48)
        Label(self, image=self.image).grid(row=0, columnspan=2, pady=10)

        Label(self,
                  text=_("Sudoku-Tk %(version)s")
                  % ({"version": VERSION})).grid(row=1, columnspan=2)
        Label(self, text=_("Sudoku games and puzzle solver")).grid(row=2, columnspan=2, padx=10)
        Label(self, text="Copyright (C) Juliette Monsel 2016-2018").grid(row=3, columnspan=2)
        Label(self, text="[email protected]").grid(row=4, columnspan=2)
        Button(self, text=_("License"), command=self._license).grid(row=5, column=0, pady=(20, 10), padx=(10,4))
        Button(self, text=_("Close"), command=self._quitter).grid(row=5, column=1, pady=(20, 10), padx=(4,10))

        self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self._quitter)
        self.resizable(0, 0)
        self.initial_focus.focus_set()
        self.wait_window(self)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:28,代码来源:about.py

示例6: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, parent, title, message, *, _htest=False, _utest=False):  # Call from override.
        """Create popup, do not return until tk widget destroyed.

        Additional subclass init must be done before calling this.

        title - string, title of popup dialog
        message - string, informational message to display
        _htest - bool, change box location when running htest
        _utest - bool, leave window hidden and not modal
        """
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=5)
        self.resizable(height=FALSE, width=FALSE)
        self.title(title)
        self.transient(parent)
        self.grab_set()
        self.bind("<Key-Return>", self.ok)
        self.protocol("WM_DELETE_WINDOW", self.cancel)
        self.parent = parent
        self.message = message
        self.create_widgets()
        self.update_idletasks()
        # needs to be done here so that the winfo_reqwidth is valid
        self.withdraw()  # Hide while configuring, especially geometry.
        self.geometry(
            "+%d+%d"
            % (
                parent.winfo_rootx() + (parent.winfo_width() / 2 - self.winfo_reqwidth() / 2),
                parent.winfo_rooty()
                + ((parent.winfo_height() / 2 - self.winfo_reqheight() / 2) if not _htest else 150),
            )
        )  # centre dialog over parent (or below htest box)
        if not _utest:
            self.deiconify()  # geometry set, unhide
            self.wait_window()
开发者ID:xulukai,项目名称:cpython,代码行数:37,代码来源:query.py

示例7: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, parent, title=None, *, _htest=False, _utest=False):
        """Create popup, do not return until tk widget destroyed.

        parent - parent of this dialog
        title - string which is title of popup dialog
        _htest - bool, change box location when running htest
        _utest - bool, don't wait_window when running unittest
        """
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=5)
        # place dialog below parent if running htest
        self.geometry("+%d+%d" % (
                        parent.winfo_rootx()+30,
                        parent.winfo_rooty()+(30 if not _htest else 100)))
        self.bg = "#bbbbbb"
        self.fg = "#000000"
        self.create_widgets()
        self.resizable(height=False, width=False)
        self.title(title or
                   f'About IDLE {python_version()} ({build_bits()} bit)')
        self.transient(parent)
        self.grab_set()
        self.protocol("WM_DELETE_WINDOW", self.ok)
        self.parent = parent
        self.button_ok.focus_set()
        self.bind('<Return>', self.ok)  # dismiss dialog
        self.bind('<Escape>', self.ok)  # dismiss dialog
        self._current_textview = None
        self._utest = _utest

        if not _utest:
            self.deiconify()
            self.wait_window()
开发者ID:1st1,项目名称:cpython,代码行数:35,代码来源:help_about.py

示例8: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
 def __init__(self, parent=None, title="", message="", button="Ok", image=None, **options):
     """
         Create a message box with one button:
             parent: parent of the toplevel window
             title: message box title
             message: message box text
             button: message displayed on the button
             image: image displayed at the left of the message
             **options: other options to pass to the Toplevel.__init__ method
     """
     Toplevel.__init__(self, parent, **options)
     self.transient(parent)
     self.resizable(False, False)
     self.title(title)
     if image:
         Label(self, text=message, wraplength=335,
               font="Sans 11", compound="left", image=image).grid(row=0, padx=10, pady=10)
     else:
         Label(self, text=message, wraplength=335,
               font="Sans 11").grid(row=0, padx=10, pady=10)
     b = Button(self, text=button, command=self.destroy)
     b.grid(row=1, padx=10, pady=10)
     self.grab_set()
     b.focus_set()
     self.wait_window(self)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:27,代码来源:custom_messagebox.py

示例9: __init__

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

        sw = parent.winfo_screenwidth()
        sh = parent.winfo_screenheight()
        self.geometry('%dx%d+%d+%d' % (sw/2, sh/2, sw/4, sh/4))
        self.grab_set()
        self.title("Settings")

        self.modeNotebook = Notebook(self)
        self.modeNotebook.pack(fill=BOTH, expand=True)

        self.addFrame = AddSettingsFrame(self.modeNotebook, self)
        self.addFrame.pack(fill=BOTH, expand=True)

        self.editFrame = EditSettingsFrame(self.modeNotebook, self)
        self.editFrame.pack(fill=BOTH, expand=True)

        self.deleteFrame = DeleteSettingsFrame(self.modeNotebook, self)
        self.deleteFrame.pack(fill=BOTH, expand=True)

        self.modeNotebook.add(self.addFrame, text='Add')
        self.modeNotebook.add(self.editFrame, text='Edit')
        self.modeNotebook.add(self.deleteFrame, text='Delete')

        self.addFrame.setupFrame()
        self.editFrame.setupFrame()
        
        self.wait_window()
开发者ID:RohanBali,项目名称:EGUANA_Python,代码行数:33,代码来源:settingsPopup.py

示例10: __init__

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

        self.result = None
        self.module_data = None
        self.mod_applis = None
        self.title(ugettext("Instance editor"))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self.ntbk = ttk.Notebook(self)
        self.ntbk.grid(row=0, column=0, columnspan=1, sticky=(N, S, E, W))

        self.frm_general = Frame(self.ntbk, width=350, height=150)
        self.frm_general.grid_columnconfigure(0, weight=0)
        self.frm_general.grid_columnconfigure(1, weight=1)
        self._general_tabs()
        self.ntbk.add(self.frm_general, text=ugettext('General'))

        self.frm_database = Frame(self.ntbk, width=350, height=150)
        self.frm_database.grid_columnconfigure(0, weight=0)
        self.frm_database.grid_columnconfigure(1, weight=1)
        self._database_tabs()
        self.ntbk.add(self.frm_database, text=ugettext('Database'))

        btnframe = Frame(self, bd=1)
        btnframe.grid(row=1, column=0, columnspan=1)
        Button(btnframe, text=ugettext("OK"), width=10, command=self.apply).grid(
            row=0, column=0, sticky=(N, S, E))
        Button(btnframe, text=ugettext("Cancel"), width=10, command=self.destroy).grid(
            row=0, column=1, sticky=(N, S, W))
开发者ID:povtux,项目名称:core,代码行数:35,代码来源:lucterios_gui.py

示例11: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, string_var, *args, **kwargs):
        Toplevel.__init__(self, *args, **kwargs)

        self.wm_title('SUDO Password')

        Label(master = self,
              text   = 'Root password:').pack()

        self._input = input = Entry(master = self,
                                    show   = '*')

        def set_pass(*args, **kwargs):
            string_var.set(input.get())
            self.destroy()

        input.bind('<KeyRelease-Return>', set_pass)
        #input.pack(side=TOP, fill=BOTH, expand=True)
        input.pack()
        input.focus_set()

        Button(master  = self,
               text    = 'Cancel',
               command = self.destroy).pack()

        Button(master  = self,
               text    = 'OK',
               command = set_pass).pack()
开发者ID:kitchenbudapest,项目名称:vr,代码行数:29,代码来源:plastey.py

示例12: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, app, kind='', icon_file=None, center=True):
        Toplevel.__init__(self)
        self.__app = app
        self.configBorders(app, kind, icon_file)

        if center:
            pass
开发者ID:minghu6,项目名称:minghu6_py,代码行数:9,代码来源:windows.py

示例13: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
    def __init__(self, parent):
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=0)
        self.geometry("+%d+%d" % (
                        parent.winfo_rootx()+30,
                        parent.winfo_rooty()+30))

        self.vbar = Scrollbar(self)
        self.text = Text(self, wrap='word', borderwidth='0p')
        self.vbar['command'] = self.text.yview
        self.vbar.pack(side=RIGHT, fill='y')
        self.text['yscrollcommand'] = self.vbar.set
        self.text.pack(expand=1, fill="both")
        try:
            f = open(README_PATH)
            self.text.delete(1.0)
            self.text.insert(1.0, f.read())
            self.text.delete('end - 1 chars')
        except:
            showerror("Error", "Cannot load README!")
        self.text.config(state='disabled')

        self.title('README')
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.parent = parent
        self.bind('<Escape>', self.close)
开发者ID:ZanderBrown,项目名称:Tiborcim,代码行数:28,代码来源:cim.py

示例14: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
 def __init__(self, dictionary, linein, master=None):
     Toplevel.__init__(self, master,  bg='black')
     #self.title("CTA Train Tracker ")
     self.driv = driver.Driver()
     self.linein = linein
     self.line = self.linein.split()
     self.stored = dictionary
     stops.make_widgets(self)
开发者ID:dahlke,项目名称:PyTrain,代码行数:10,代码来源:stops.py

示例15: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import __init__ [as 别名]
 def __init__(self, trains, time, stop, master=None):
     Toplevel.__init__(self, master, bg="black")
     # self.title("CTA Train Tracker ")
     self.driv = driver.Driver()
     self.tra = trains
     self.tim = time
     self.stop = stop
     times.make_widgets(self)
开发者ID:dahlke,项目名称:PyTrain,代码行数:10,代码来源:times.py


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