Tkinter Toplevel:顶层部件的工作,直接由窗口管理器管理的窗口。他们不必在它们上面的父widget
 
顶层部件的工作,直接由窗口管理器管理的窗口。他们不必在它们上面的父widget.

你的应用程序可以使用任意数量的顶层窗口.

语法:

这里是一个简单的语法来创建这个widget:

w = Toplevel ( option, ... )

参数:

  • options: 下面是这个小工具最常用的选项列表。这些选项可以作为键 - 值对以逗号分隔.

Option Description
bg The background color of the window.
bd Border width in pixels; default is 0.
cursor The cursor that appears when the mouse is in this window.
class_ Normally, text selected within a text widget is exported to be the selection in the window manager. Set exportselection=0 if you don't want that behavior.
font The default font for text inserted into the widget.
fg The color used for text (and bitmaps) within the widget. You can change the color for tagged regions; this option is just the default.
height Window height.
relief Normally, a top-level window will have no 3-d borders around it. To get a shaded border, set the bd option larger that its default value of zero, and set the relief option to one of the constants.
width The desired width of the window.

方法:

量表的对象有这些方法:

Methods & Description
deiconify()
Displays the window, after using either the iconify or the withdraw methods.
frame()
Returns a system-specific window identifier.
group(window)
Adds the window to the window group administered by the given window.
iconify()
Turns the window into an icon, without destroying it.
protocol(name, function)
Registers a function as a callback which will be called for the given protocol.
iconify()
Turns the window into an icon, without destroying it.
state()
Returns the current state of the window. Possible values are normal, iconic, withdrawn, and icon.
transient([master])
Turns the window into a temporary(transient) window for the given master, or to the window's parent, when no argument is given.
withdraw()
Removes the window from the screen, without destroying it.
maxsize(width, height)
Defines the maximum size for this window.
minsize(width, height)
Defines the minimum size for this window.
positionfrom(who)
Defines the position controller.
resizable(width, height)
Defines the resize flags, which control whether the window can be resized.
sizefrom(who)
Defines the size controller.
title(string)
Defines the window title.

例子:

自行尝试下面的例子:

from Tkinter import *

root = Tk()
top = Toplevel() top.mainloop()

这将产生以下结果:

Tkinter Toplevel的更多相关文章

  1. Tkinter隐藏窗口再让他显示出来的例子

    隐藏主要是 : withdraw()函数. 重新显示出来主要是: update()和deiconify()函数. 来源:http://www.blog.pythonlibrary.org/2012/0 ...

  2. 基于tkinter的GUI编程

    tkinter:tkinter是绑定了Python的TKGUI工具集,就是Python包装的Tcl代码,通过内嵌在Python解释器内部的Tcl解释器实现的,它是Python标准库的一部分,所以使用它 ...

  3. gui - tkinter 开发

    GUI 用户交互界面 tkinter 介绍 tkinter python自带的gui库,对图形图像处理库tk的封装 其他gui:pythonwin,wxpython,pyQT.. 概念介绍 组件:组成 ...

  4. Python下划线与命名规范

    Python下划线与命名规范 先看结论,节省只想知道答案你的宝贵时间: _xxx 不能用于from module import * 以单下划线开头的表示的是protected类型的变量.即保护类型只能 ...

  5. 详解 Python 中的下划线命名规则

    在 python 中,下划线命名规则往往令初学者相当 疑惑:单下划线.双下划线.双下划线还分前后……那它们的作用与使用场景 到底有何区别呢?今天 就来聊聊这个话题. 1.单下划线(_) 通常情况下,单 ...

  6. Python编程规范(PEP8)

    Python编程规范(PEP8) 代码布局 缩进 对于每一次缩进使用4个空格.使用括号.中括号.大括号进行垂直对齐,或者缩进对齐. 制表符还是空格? 永远不要将制表符与空格混合使用.Python最常用 ...

  7. python代码风格指南:pep8 中文翻译

    摘要 本文给出主Python版本标准库的编码约定.CPython的C代码风格参见​PEP7.本文和​PEP 257 文档字符串标准改编自Guido最初的<Python Style Guide&g ...

  8. 【Python网络编程】多线程聊天软件程序

    课程设计的时候制作的多线程聊天软件程序 基于python3.4.3 import socket import pickle import threading import tkinter import ...

  9. Python倒计时器(转)

    # Countdown using Tkinter from Tkinter import * import time import tkMessageBox class App: def __ini ...

随机推荐

  1. Java面试题收集以及参考答案(100道)

    不积跬步无以至千里,这里会不断收集和更新Java基础相关的面试题,目前已收集100题. 1.什么是B/S架构?什么是C/S架构 B/S(Browser/Server),浏览器/服务器程序 C/S(Cl ...

  2. crm 03--> crm与权限结合

    ---恢复内容开始--- 1:先分组 2:给权限分组 3:具体的权限(即设计url) 二:制作左侧菜单,显示当前用户拥有的权限 关于项目下的templates里的HTML查找顺序 先从根目录找,找不到 ...

  3. C# parser JSON get Key and value

    /*********************************************************************** * C# parser JSON get Key an ...

  4. phpcms修改增加编辑时摘要自动提取的数量

    \caches\caches_model\caches_data\model_field_1.cache.php 搜索 name="introcude_length" value= ...

  5. cocos2d-x 3.17 jsb android运行报错

    编译成功,运行失败,提示如下: 2018-11-15 19:09:56.343 2820-2852/net.jd85.test D/cocos2d-x debug info: cocos2d: ful ...

  6. 每天一个linux命令:【转载】head命令

    head 与 tail 就像它的名字一样的浅显易懂,它是用来显示开头或结尾某个数量的文字区块,head 用来显示档案的开头至标准输出中,而 tail 想当然尔就是看档案的结尾. 1.命令格式: hea ...

  7. BZOJ1412 ZJOI2009 狼和羊的故事 【网络流-最小割】

    BZOJ1412 ZJOI2009 狼和羊的故事 Description “狼爱上羊啊爱的疯狂,谁让他们真爱了一场:狼爱上羊啊并不荒唐,他们说有爱就有方向......” Orez听到这首歌,心想:狼和 ...

  8. IIS并发瓶颈线程数的限制

    .NET线程池最大线程数的限制-记一次IIS并发瓶颈 https://www.cnblogs.com/7rhythm/p/9964543.html .NET ThreadPool 最大线程数的限制 I ...

  9. ballerina 学习二 ballerina 命令参数

    1.  目前支持的命令 run Run Ballerina program build Compile Ballerina program install Install packages to ho ...

  10. Nchan nginx 支持的开源消息推送模块

    1. 介绍 // 官方说明 Nchan is a scalable, flexible pub/sub server for the modern web, built as a module for ...