Tkinter Toplevel
你的应用程序可以使用任意数量的顶层窗口.
语法:
这里是一个简单的语法来创建这个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的更多相关文章
- Tkinter隐藏窗口再让他显示出来的例子
隐藏主要是 : withdraw()函数. 重新显示出来主要是: update()和deiconify()函数. 来源:http://www.blog.pythonlibrary.org/2012/0 ...
- 基于tkinter的GUI编程
tkinter:tkinter是绑定了Python的TKGUI工具集,就是Python包装的Tcl代码,通过内嵌在Python解释器内部的Tcl解释器实现的,它是Python标准库的一部分,所以使用它 ...
- gui - tkinter 开发
GUI 用户交互界面 tkinter 介绍 tkinter python自带的gui库,对图形图像处理库tk的封装 其他gui:pythonwin,wxpython,pyQT.. 概念介绍 组件:组成 ...
- Python下划线与命名规范
Python下划线与命名规范 先看结论,节省只想知道答案你的宝贵时间: _xxx 不能用于from module import * 以单下划线开头的表示的是protected类型的变量.即保护类型只能 ...
- 详解 Python 中的下划线命名规则
在 python 中,下划线命名规则往往令初学者相当 疑惑:单下划线.双下划线.双下划线还分前后……那它们的作用与使用场景 到底有何区别呢?今天 就来聊聊这个话题. 1.单下划线(_) 通常情况下,单 ...
- Python编程规范(PEP8)
Python编程规范(PEP8) 代码布局 缩进 对于每一次缩进使用4个空格.使用括号.中括号.大括号进行垂直对齐,或者缩进对齐. 制表符还是空格? 永远不要将制表符与空格混合使用.Python最常用 ...
- python代码风格指南:pep8 中文翻译
摘要 本文给出主Python版本标准库的编码约定.CPython的C代码风格参见PEP7.本文和PEP 257 文档字符串标准改编自Guido最初的<Python Style Guide&g ...
- 【Python网络编程】多线程聊天软件程序
课程设计的时候制作的多线程聊天软件程序 基于python3.4.3 import socket import pickle import threading import tkinter import ...
- Python倒计时器(转)
# Countdown using Tkinter from Tkinter import * import time import tkMessageBox class App: def __ini ...
随机推荐
- memcached asp.net
下载文件 memcached 1.解压缩文件到e:\memcached 2.命令行输入 e:\memcached\memcached.exe -d install' 3.命令行输入 e:\memcac ...
- Swift UIAlertController、UISegmentedControl
// MARK: 提示框 func _initAlertView() { let btn = UIButton(type: UIButtonType.ContactAdd) btn.frame = C ...
- linux下升级svn版本到1.8
CentOS6.5默认yum安装的svn版本为1.6,有时候遇到比较高级的应用就可能不够使用,这时候就需要升级一下svn的版本,可以升级到的版本为1.8 ====== 完美的分割线 ====== 1. ...
- 特性属性 @property
实现其它语言所拥有的 getter 和 setter 的功能 作用: 用来模拟一个属性 通过@property 装饰器可以对模拟属性的取值和赋值加以控制 class Student: def __in ...
- SVM处理多分类问题(one-versus-rest和one-versus-one的不同)
SVM算法最初是为二值分类问题设计的,当处理多类问题时,就需要构造合适的多类分类器. 目前,构造SVM多类分类器的方法主要有两类:一类是直接法,直接在目标函数上进行修改,将多个分类面的参数求解合并到一 ...
- Base64编码的 换行 转义
用Base64编码的时候如果出现\n 之类的字符,java中转义. 当字符串过长(一般超过76)时会自动在中间加一个换行符,字符串最后也会加一个换行符.导致和其他模块对接时结果不一致. 解决方法:将 ...
- IOS SEL (@selector) 原理及使用总结(一)
SEL 类成员方法的指针 可以理解 @selector()就是取类方法的编号,他的行为基本可以等同C语言的中函数指针,只不过C语言中,可以把函数名直接赋给一个函数指针,而Object-C的类不能直接应 ...
- iOS获取图片格式
我们系统使用的一般文件格式有png.jpg.jpeg.GIF.TIFF 等格式: 图片是我们开发过程中最常见的东西,一般每个公司都会有自己的文件服务器,客户端人员都会从文件服务器中获取相关的图片信息: ...
- 接口测试基础——第7篇 简单的Python知识普及(二)之装饰器
今天我们来学习python里面的“装饰器” 1.我在函数test运行前想先打印一些内容怎么办? def func(param): print u"打印的内容" para ...
- python当前路径
os.getcwd()获取系统路径 sys.path [0]获取当前路径