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


Python Toplevel.title方法代码示例

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


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

示例1: _io_binding

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
def _io_binding(parent):  # htest #
    from tkinter import Toplevel, Text
    from idlelib.configHandler import idleConf

    root = Toplevel(parent)
    root.title("Test IOBinding")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    class MyEditWin:
        def __init__(self, text):
            self.text = text
            self.flist = None
            self.text.bind("<Control-o>", self.open)
            self.text.bind("<Control-s>", self.save)
        def get_saved(self): return 0
        def set_saved(self, flag): pass
        def reset_undo(self): pass
        def open(self, event):
            self.text.event_generate("<<open-window-from-file>>")
        def save(self, event):
            self.text.event_generate("<<save-window>>")

    text = Text(root)
    text.pack()
    text.focus_set()
    editwin = MyEditWin(text)
    IOBinding(editwin)
开发者ID:BCSharp,项目名称:ironpython3,代码行数:29,代码来源:IOBinding.py

示例2: receivePrivateChat

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
 def receivePrivateChat(self, connectingUser):
     global conversationBoxList
     print("CHAT PRIVATA in arrivo con "+connectingUser)
         
     newWindow = Toplevel(self.parent)
     newWindow.title("Python Chat requested by "+connectingUser)
     newWindow.minsize(400, 475)
     newWindow.focus()
     
     def disconnectPM():
         del conversationBoxList[connectingUser]
         newWindow.destroy()
     newWindow.protocol('WM_DELETE_WINDOW', disconnectPM)
     
     #label = Label(newWindow, text="PROVA PROVA")
     #label.pack(side="top", fill="both", padx=10, pady=10)
     frame = Frame(newWindow)
     frame.pack(fill=BOTH, expand=1, side=LEFT)
     
     box = ScrolledText(frame, wrap=WORD, relief = GROOVE, width=30, height=18, font=self.customFontMessage)
     box.config(state=DISABLED)
     box.pack(expand="yes", fill=BOTH, side=TOP)
     
     textarea = Text(frame, width=30, height=5)
     textarea.bind("<KeyRelease-Return>", lambda event : self.getprivatetext(event, textarea, connectingUser)) 
     textarea.pack(expand="yes", fill=BOTH, side=TOP)
     
     #aggiungo alla mappa globale il box di conversazione
     conversationBoxList[connectingUser] = box
开发者ID:skimdz86,项目名称:Utilities,代码行数:31,代码来源:BlinkingChatGUIMultiClient.py

示例3: display_image

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
def display_image(title,image):
    win = Toplevel(root)
    photo = ImageTk.PhotoImage(image)
    win.title(title)
    label = Label(win,image=photo)
    label.image = photo #Kludge: keep a reference to avoid garbage collection!
    label.pack()
开发者ID:cmarch314,项目名称:PythonProjects,代码行数:9,代码来源:pildemo.py

示例4: helpAbout

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
 def helpAbout(self):
     print("Digital Cookbook v1.0 - Theodore Lindsey")
     aboutDialog = Toplevel()
     aboutDialog.geometry("200x100+300+300")
     aboutDialog.title("About Digital Cookbook")
     Message(aboutDialog, text="Digital Cookbook v1.0\nTheodore Lindsey").pack(side=TOP, fill=BOTH, expand=1)
     Button(aboutDialog, text="Ok", command=aboutDialog.destroy).pack(side=TOP)
开发者ID:RagingRoosevelt,项目名称:RecipeManagerV2,代码行数:9,代码来源:gui.py

示例5: _replace_dialog

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
def _replace_dialog(parent):  # htest #
    from tkinter import Toplevel, Text
    from tkiter.ttk import Button

    box = Toplevel(parent)
    box.title("Test ReplaceDialog")
    x, y = map(int, parent.geometry().split('+')[1:])
    box.geometry("+%d+%d" % (x, y + 175))

    # mock undo delegator methods
    def undo_block_start():
        pass

    def undo_block_stop():
        pass

    text = Text(box, inactiveselectbackground='gray')
    text.undo_block_start = undo_block_start
    text.undo_block_stop = undo_block_stop
    text.pack()
    text.insert("insert","This is a sample sTring\nPlus MORE.")
    text.focus_set()

    def show_replace():
        text.tag_add(SEL, "1.0", END)
        replace(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(box, text="Replace", command=show_replace)
    button.pack()
开发者ID:Darkness0ut,项目名称:cpython,代码行数:32,代码来源:replace.py

示例6: _io_binding

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

    root = Toplevel(parent)
    root.title("Test IOBinding")
    x, y = map(int, parent.geometry().split('+')[1:])
    root.geometry("+%d+%d" % (x, y + 175))
    class MyEditWin:
        def __init__(self, text):
            self.text = text
            self.flist = None
            self.text.bind("<Control-o>", self.open)
            self.text.bind('<Control-p>', self.print)
            self.text.bind("<Control-s>", self.save)
            self.text.bind("<Alt-s>", self.saveas)
            self.text.bind('<Control-c>', self.savecopy)
        def get_saved(self): return 0
        def set_saved(self, flag): pass
        def reset_undo(self): pass
        def open(self, event):
            self.text.event_generate("<<open-window-from-file>>")
        def print(self, event):
            self.text.event_generate("<<print-window>>")
        def save(self, event):
            self.text.event_generate("<<save-window>>")
        def saveas(self, event):
            self.text.event_generate("<<save-window-as-file>>")
        def savecopy(self, event):
            self.text.event_generate("<<save-copy-of-window-as-file>>")

    text = Text(root)
    text.pack()
    text.focus_set()
    editwin = MyEditWin(text)
    IOBinding(editwin)
开发者ID:3lnc,项目名称:cpython,代码行数:37,代码来源:iomenu.py

示例7: toplevel

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
def toplevel(parent, title):
    t = Toplevel(parent, borderwidth=8)
    t.title(title)
    x = parent.winfo_rootx()
    y = parent.winfo_rooty()
    t.geometry('+{}+{}'.format(x+4, y+4))
    return t
开发者ID:zapfsaeulius,项目名称:zephyrus,代码行数:9,代码来源:gui.py

示例8: _color_delegator

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

    top = Toplevel(parent)
    top.title("Test ColorDelegator")
    x, y = map(int, parent.geometry().split('+')[1:])
    top.geometry("700x250+%d+%d" % (x + 20, y + 175))
    source = (
        "if True: int ('1') # keyword, builtin, string, comment\n"
        "elif False: print(0)\n"
        "else: float(None)\n"
        "if iF + If + IF: 'keyword matching must respect case'\n"
        "if'': x or''  # valid string-keyword no-space combinations\n"
        "# All valid prefixes for unicode and byte strings should be colored.\n"
        "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
        "r'x', u'x', R'x', U'x', f'x', F'x'\n"
        "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"
        "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n"
        "# Invalid combinations of legal characters should be half colored.\n"
        "ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'"
        )
    text = Text(top, background="white")
    text.pack(expand=1, fill="both")
    text.insert("insert", source)
    text.focus_set()

    color_config(text)
    p = Percolator(text)
    d = ColorDelegator()
    p.insertfilter(d)
开发者ID:dstanek,项目名称:cpython,代码行数:33,代码来源:colorizer.py

示例9: _color_delegator

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

    top = Toplevel(parent)
    top.title("Test ColorDelegator")
    x, y = map(int, parent.geometry().split('+')[1:])
    top.geometry("700x250+%d+%d" % (x + 20, y + 175))
    source = ("# Following has syntax errors\n"
        "if True: then int 1\nelif False: print 0\nelse: float(None)\n"
        "if iF + If + IF: 'keywork matching must respect case'\n"
        "# All valid prefixes for unicode and byte strings should be colored\n"
        "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
        "r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\n"
        "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"
        "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n")
    text = Text(top, background="white")
    text.pack(expand=1, fill="both")
    text.insert("insert", source)
    text.focus_set()

    color_config(text)
    p = Percolator(text)
    d = ColorDelegator()
    p.insertfilter(d)
开发者ID:1st1,项目名称:cpython,代码行数:27,代码来源:colorizer.py

示例10: __init__

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

        self.window = Toplevel()
        self.window.title('Информация об объектах и мире')
        self.window.geometry("640x600+250+200")

        self._inner_init()
        self.frame.pack()

        self.window.mainloop()

    def _inner_init(self):
        self.frame = Frame(self.window,
                           width=640,
                           height=600,
                           bd=2)
        self.frame.grid_bbox(2, 2)

        self._about_world()
        self._about_creatures()

    def _about_world(self):
        self.world_indo = self.model.info()

        TEXT = "Кол-во объектов: {cr_count}\n" \
               "Из них живые: {cr_alive}".format(**self.world_indo)
        Label(self.frame,
              text=TEXT).grid(row=1, column=1)

    def _about_creatures(self):
        lb = Listbox(self.frame,
                     height=15,
                     width=50,
                     selectmode=SINGLE)
        lb.bind('<<ListboxSelect>>', self._onselect)
        lb.grid(row=1, column=2)

        items = self.model.creatures.items()
        items = sorted(items, key=lambda k: k[0][0] * self.model.width + k[0][1])

        for (x, y), creature in items:
            lb.insert(END, [x, y, creature.life])

        self.canvas = NeuroCanvas(self.frame, (2, 2), 400, 300)

    def _onselect(self, evt):
        w = evt.widget
        index = int(w.curselection()[0])
        value = w.get(index)
        x, y, *_ = value[1:].split(",")
        x = int(x)
        y = int(y)
        cr = self.model.creatures[(x, y)]

        neuro = cr.genome

        self.canvas.draw(neuro)
开发者ID:ktulhy-kun,项目名称:neurolife,代码行数:61,代码来源:info_window.py

示例11: __init__

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
class MailListWindow:
    def __init__(self, title, after_close):
        self.win = Toplevel()
        self.win.title(title)
        self.win.geometry('400x200')
        self.win.wm_attributes('-toolwindow', True)
        self.win.protocol("WM_DELETE_WINDOW", after_close)
        
        inner_frame = tk.Frame(self.win)#inner_frame = tk.Frame(canvas)
        inner_frame.pack(side='left', fill='both', expand = 1)
        scrollbar = tk.Scrollbar(self.win,orient="vertical",command=self.scrolly)
        scrollbar.pack(side='right', fill='y')
        
        self.btn_count = 0
        self.btns = []
        self.texts = []
        self.callbacks = []
        self.frame = inner_frame
        self.scrollbar = scrollbar
        self.btn_per_page = 4
        self.first_btn = 0
        self.scrolly('', '0.0')
        
    def scrolly(self, cmd, pos, what=''):
        if self.btn_per_page <= self.btn_count:
            bar_len = self.btn_per_page/self.btn_count
        else:
            bar_len=1
        self.first_btn = int(float(pos)*self.btn_count)
        pos = str(self.getScrollPos())
        self.scrollbar.set(pos, str(float(pos)+bar_len))
        for i in range(len(self.btns)):
            mail_index = i+self.first_btn
            self.btns[i].config(text=self.texts[mail_index], command=self.callbacks[mail_index])
    
    def insertButton(self, text, callback):
        if self.btn_count < self.btn_per_page:
            btn = tk.Button(self.frame, bg='#fafafa',text=text, command=callback)
            btn.pack(fill='both', expand=1)
            self.btns.append(btn)
            
        self.btn_count += 1
        self.texts.append(text) 
        self.callbacks.append(callback)
        self.scrolly('', self.getScrollPos())
        
    def getScrollPos(self):
        if self.btn_per_page >= self.btn_count:
            return 0.0
        if self.btn_count == 0:
            return 0.0
        return self.first_btn/self.btn_count
        
    def callback(self):
        print('click')
        
    def destroy(self):
        self.win.destroy()
开发者ID:misterlihao,项目名称:network-programming-project,代码行数:60,代码来源:MailListWindow.py

示例12: toolbox_window

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
 def toolbox_window(self):
     """Creates the window which will host the toolbox buttons"""
     toolbox_root = Toplevel()
     toolbox_root.title("Toolbox")
     toolbox_root.geometry("455x256")
     toolbox_frame = Frame(toolbox_root)
     toolbox_frame.pack(fill=BOTH)
     
     
开发者ID:jkesselring,项目名称:DnDApp,代码行数:9,代码来源:map.py

示例13: TkWindowNode

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
class TkWindowNode(BaseWindowNode):
    '''The base class of all the Window Node in the WaveSyn Object Model.
Properties:
    tk_object: The underlying Tk Toplevel object;
    node_path: The path of this node on the WaveSyn Object Model Tree.
Properties inherited from ModelNode:
    root_node: The root node of the WaveSyn Object Model Tree.
'''
    window_name = ''
    _xmlrpcexport_  = ['close']    
    
    
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.__tk_object = Toplevel()
        self.__tk_object.title(f'{self.window_name} id={id(self)}')
        self.__tk_object.protocol('WM_DELETE_WINDOW', self.on_close)
    
            
    method_name_map   = {
        'update':'update', 
        'set_window_attributes':'wm_attributes'
    }
    
    for method_name in method_name_map:
        locals()[method_name] = MethodDelegator('tk_object', 
                                                method_name_map[method_name])


    def _close_callback(self):
        pass        

       
    @Scripting.printable
    def close(self):
        #Scripting.root_node.on_window_quit(self)
        if hasattr(self.parent_node, 'on_window_close'):
            self.parent_node.on_window_close(self)
        # For Toplevel objects, use destroy rather than quit.
        if not self._close_callback():
            self.__tk_object.destroy() 
        
        
    def on_close(self):
        with code_printer():
            self.close()
        
            
    @property
    def tk_object(self):
        return self.__tk_object
    
        
    def create_timer(self, interval=100, active=False):
        return TkTimer(self.__tk_object, interval, active)
开发者ID:xialulee,项目名称:WaveSyn,代码行数:57,代码来源:tkbasewindow.py

示例14: __init__

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

示例15: progress

# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import title [as 别名]
 def progress( self ):
     o=os.popen("cd {0} && snakemake --dryrun --rerun-incomplete > {0}/Reports/checkpoint".format(self.workpath.get()))
     o.close()
     F=open("{0}/Reports/checkpoint".format(self.workpath.get()),"r").read()
     rules2={}
     rules=re.findall(r'rule .+:',F)
     for i in rules:
         i=re.sub("rule ","",i)
         i=re.sub(":","",i)
         rules2[i]=0
 
 
     F=open("{0}/Reports/{1}.dot".format(self.workpath.get(), self.Pipeline.get() ),"r").read()
     for i in rules2.keys():
         F=re.sub(r'('+i+')(\".+?)\".+?\"',r'\1_pending\2"0.0 0.0 0.0"',F)
 #        F=re.sub(i,"",F)
 
 
     G=open("{0}/Reports/{1}-{2}.dot".format(self.workpath.get(),self.Pipeline.get(),"progress"),"w")
     G.write(F)
     G.close()
 
     o=os.popen("cd {0}/Reports && dot -Tpng -o {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.dot;convert {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.gif".format(self.workpath.get(),self.Pipeline.get()))
 
 #    tkinter.messagebox.showerror("o",o)
 
     PL=self.Pipeline.get() #pipelineget()
     gf=Toplevel()
 
     gf.title("CCBR Pipeliner: {0} Progress Graph".format(PL))
     cgf = Canvas(gf,bg="white")
 #    gff=Frame(cgf,width=300,height=300)
     xscrollbar = Scrollbar(gf, orient=HORIZONTAL)
     xscrollbar.pack(side = BOTTOM, fill=X )
     xscrollbar.config(command=cgf.xview)
 
     yscrollbar = Scrollbar(gf,orient=VERTICAL)
     yscrollbar.pack(side = RIGHT, fill=Y )
     yscrollbar.config(command=cgf.yview)
 
     cgf.config(xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set)
     cgf.config(width=600,height=600)
     cgf.pack(expand=1,fill=BOTH,side=RIGHT)
     cgf.config(scrollregion=(0,0,1000,5000))
     try:
         time.sleep(5)
         img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL))
     except:
         time.sleep(5)
         img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL))
     cgf.create_image(0,0,image=img, anchor="nw")
     cgf.image=img
开发者ID:felloumi,项目名称:Pipeliner,代码行数:54,代码来源:frame.py


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