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


Python Tkinter.Toplevel方法代码示例

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


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

示例1: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def __init__(self, main_window, msg='Please enter a node:'):
        tk.Toplevel.__init__(self)
        self.main_window = main_window
        self.title('Node Entry')
        self.geometry('170x160')
        self.rowconfigure(3, weight=1)

        tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
                                      sticky='NESW',padx=5,pady=5)
        self.posibilities = [d['dataG_id'] for n,d in
                    main_window.canvas.dispG.nodes_iter(data=True)]
        self.entry = AutocompleteEntry(self.posibilities, self)
        self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
        self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)

        tk.Button(self, text='Ok', command=self.destroy).grid(
            row=3, column=0, sticky='ESW',padx=5,pady=5)
        tk.Button(self, text='Cancel', command=self.cancel).grid(
            row=3, column=1, sticky='ESW',padx=5,pady=5)

        # Make modal
        self.winfo_toplevel().wait_window(self) 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:24,代码来源:viewer.py

示例2: showtip

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def showtip(self, text):
        "Display text in tooltip window"
        self.text = text
        if self.tipwindow or not self.text:
            return
        x, y, _, _ = self.widget.bbox("insert")
        x = x + self.widget.winfo_rootx() + 27
        y = y + self.widget.winfo_rooty()
        self.tipwindow = tw = Tk.Toplevel(self.widget)
        tw.wm_overrideredirect(1)
        tw.wm_geometry("+%d+%d" % (x, y))
        try:
            # For Mac OS
            tw.tk.call("::tk::unsupported::MacWindowStyle",
                       "style", tw._w,
                       "help", "noActivates")
        except Tk.TclError:
            pass
        label = Tk.Label(tw, text=self.text, justify=Tk.LEFT,
                      background="#ffffe0", relief=Tk.SOLID, borderwidth=1,
                      )
        label.pack(ipadx=1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:backend_tkagg.py

示例3: _color_delegator

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def _color_delegator(parent):  # htest #
    from Tkinter import Toplevel, Text
    from idlelib.Percolator import Percolator

    top = Toplevel(parent)
    top.title("Test ColorDelegator")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    source = "if somename: x = 'abc' # comment\nprint\n"
    text = Text(top, background="white")
    text.pack(expand=1, fill="both")
    text.insert("insert", source)
    text.focus_set()

    p = Percolator(text)
    d = ColorDelegator()
    p.insertfilter(d) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:19,代码来源:ColorDelegator.py

示例4: _dyn_option_menu

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [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:aliyun,项目名称:oss-ftp,代码行数:20,代码来源:dynOptionMenuWidget.py

示例5: _calltip_window

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def _calltip_window(parent):  # htest #
    from Tkinter import Toplevel, Text, LEFT, BOTH

    top = Toplevel(parent)
    top.title("Test calltips")
    top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
                  parent.winfo_rooty() + 150))
    text = Text(top)
    text.pack(side=LEFT, fill=BOTH, expand=1)
    text.insert("insert", "string.split")
    top.update()
    calltip = CallTip(text)

    def calltip_show(event):
        calltip.showtip("(s=Hello world)", "insert", "end")
    def calltip_hide(event):
        calltip.hidetip()
    text.event_add("<<calltip-show>>", "(")
    text.event_add("<<calltip-hide>>", ")")
    text.bind("<<calltip-show>>", calltip_show)
    text.bind("<<calltip-hide>>", calltip_hide)
    text.focus_set() 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:24,代码来源:CallTipWindow.py

示例6: _show

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack() 
开发者ID:tp4a,项目名称:teleport,代码行数:20,代码来源:ImageTk.py

示例7: edit_experimental_settings

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def edit_experimental_settings(self):
        """Settings menu for experimental features."""

        self.experimental_settings_container = tk.Toplevel(bg='white')
        self.experimental_settings_container.geometry('300x400')
        self.experimental_settings_container.wm_title('Experimental settings')
        self.experimental_settings_container.protocol(
            'WM_DELETE_WINDOW', self.experimental_settings_container.destroy)

        tk.Button(self.experimental_settings_container, text='Save and close',
                  command=self.experimental_settings_container.destroy).pack()

        experimental_settings_cb = tk.Checkbutton(
            self.experimental_settings_container,
            text="Enable experimental settings",
            variable=self.settings['experimental_settings'],
            height=2, width=20, bg='white')
        experimental_settings_cb.pack(expand=True)
        tip = dedent("""Enable experimental settings.""")
        ToolTip(experimental_settings_cb, text=tip, wraplength=750) 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:22,代码来源:gui.py

示例8: example1

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def example1():
    def print_sel():
        print(cal.selection_get())
        cal.see(datetime.date(year=2016, month=2, day=5))

    top = tk.Toplevel(root)

    import datetime
    today = datetime.date.today()

    mindate = datetime.date(year=2018, month=1, day=21)
    maxdate = today + datetime.timedelta(days=5)
    print(mindate, maxdate)

    cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US',
                   mindate=mindate, maxdate=maxdate, disabledforeground='red',
                   cursor="hand1", year=2018, month=2, day=5)
    cal.pack(fill="both", expand=True)
    ttk.Button(top, text="ok", command=print_sel).pack() 
开发者ID:j4321,项目名称:tkcalendar,代码行数:21,代码来源:__main__.py

示例9: display

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def display(self, parent, near=None):
        """ Display the help dialog.

            parent - parent widget for the help window

            near - a Toplevel widget (e.g. EditorWindow or PyShell)
                   to use as a reference for placing the help window
        """
        import warnings as w
        w.warn("EditorWindow.HelpDialog is no longer used by Idle.\n"
               "It will be removed in 3.6 or later.\n"
               "It has been replaced by private help.HelpWindow\n",
               DeprecationWarning, stacklevel=2)
        if self.dlg is None:
            self.show_dialog(parent)
        if near:
            self.nearwindow(near) 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:19,代码来源:EditorWindow.py

示例10: mainloop

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def mainloop(self):
        try:
            import Tkinter as tk
        except ImportError:
            import tkinter as tk
        from PIL import Image, ImageTk
        from ttk import Frame, Button, Style
        import time
        import socket
        self.root = tk.Toplevel() #Tk()
        self.root.title('Display')
        self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
        self.image1 = ImageTk.PhotoImage(self.image)
        self.panel1 = tk.Label(self.root, image=self.image1)
        self.display = self.image1
        self.frame1 = Frame(self.root, height=50, width=50)
        self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        self.root.after(100, self.advance_image)
        self.root.after(100, self.update_image)
        self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
        #global _started_tkinter_main_loop
        #if not _started_tkinter_main_loop:
        #    _started_tkinter_main_loop = True
        #    print("Starting Tk main thread...") 
开发者ID:jahuth,项目名称:convis,代码行数:26,代码来源:streams.py

示例11: _show

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def _show(image, title):

    class UI(Tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            Tkinter.Label.__init__(self, master, image=self.image,
                bg="black", bd=0)

    if not Tkinter._default_root:
        raise IOError, "tkinter not initialized"
    top = Tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack() 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:19,代码来源:ImageTk.py

示例12: destroy

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def destroy(self):
        res = self.entry.get()
        if res not in self.posibilities:
            res = None
        self.result = res
        tk.Toplevel.destroy(self) 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:8,代码来源:viewer.py

示例13: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def __init__(self, parent, chart, toplevel=True, title='Chart Matrix',
                 show_numedges=False):
        self._chart = chart
        self._cells = []
        self._marks = []
        
        self._selected_cell = None

        if toplevel:
            self._root = Tkinter.Toplevel(parent)
            self._root.title(title)
            self._root.bind('<Control-q>', self.destroy)
            self._init_quit(self._root)
        else:
            self._root = Tkinter.Frame(parent)

        self._init_matrix(self._root)
        self._init_list(self._root)
        if show_numedges:
            self._init_numedges(self._root)
        else:
            self._numedges_label = None

        self._callbacks = {}
        
        self._num_edges = 0

        self.draw() 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:30,代码来源:chart.py

示例14: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def __init__(self, imagefileName, title):
		self._root = Tkinter.Toplevel()
		self._root.title(title + ' (' + imagefileName + ')')
		self.image = Tkinter.PhotoImage("LGraph",file=imagefileName)

		Tkinter.Label(self._root, image=self.image).pack(side='top',fill='x')
		# self._root.mainloop() 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:9,代码来源:kimmo.py

示例15: _adjust_lens1

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Toplevel [as 别名]
def _adjust_lens1(self):
        self._destroy(self.win_lens1)
        try:
            self.win_lens1 = tk.Toplevel(self.parent)
            FisheyeAlignmentGUI(self.win_lens1, self.img1.get(), self.lens1)
        except IOError:
            self._destroy(self.win_lens1)
            tkMessageBox.showerror('Error', 'Unable to read image file #1.')
        except:
            self._destroy(self.win_lens1)
            tkMessageBox.showerror('Dialog creation error', traceback.format_exc()) 
开发者ID:ooterness,项目名称:DualFisheye,代码行数:13,代码来源:fisheye.py


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