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 ...
随机推荐
- ubuntu下codeblock美化
1.备份配置文件:default.conf. 2.将default.conf中的内容替换为最下面代码,并保存. 3.打开codeblock,Setting-Editor-Syntax,然后选择Colo ...
- 求 LCA 的三种方法
(YYL: LCA 有三种求法, 你们都知道么?) (众神犇: 这哪里来的傻叉...) 1. 树上倍增 对于求 LCA, 最朴素的方法是"让两个点一起往上爬, 直到相遇", &qu ...
- 10day2
最多因子数 搜索 [问题描述] 数学家们喜欢各种类型的有奇怪特性的数.例如,他们认为 945 是一个有趣的数,因为它是第一个所有约数之和大于本身的奇数. 为了帮助他们寻找有趣的数,你将写一个程序扫描一 ...
- 如何用OpenCV跟踪鼠标操作
转载:如何用OpenCV跟踪鼠标操作 http://blog.skyoung.org/2014/05/01/how-to-track-mouse/ 在视频第一帧手动标记出目标的位置是在线视觉跟踪中最基 ...
- strcpy手写——面试
#include<stdio.h> #include<string.h> ]={]; char* strcpy(char *to,char *from){ if(NULL==t ...
- 【备忘:待完善】nsq集群初体验
本机的一个节点及监控与管理后台 虚拟机中的一个节点 命令: [root@vm-vagrant nsq]# nsqd --lookupd-tcp-address=192.168.23.150:4160 ...
- 18.9.10 LeetCode刷题笔记
本人算法还是比较菜的,因此大部分在刷基础题,高手勿喷 选择Python进行刷题,因为坑少,所以不太想用CPP: 1.买股票的最佳时期2 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格. ...
- CentOS(五)--Linux系统的分区概念
一.系统分区 首先先普及一下有关系统分区的一些知识: 硬盘分区有三种,主磁盘分区.扩展磁盘分区.逻辑分区. 一个硬盘主分区至少有1个,最多4个,扩展分区可以没有,最多1个.且主分区+扩展分区总共不能超 ...
- ssdb的golang驱动的同步问题
如果数据库连接只有一个,在某个时间点(指的是某个及其短的时间内),多个读写的话,会出问题,修改了下,加了个mutex,算是解决了此问题,贴下备忘 var mutex sync.Mutex func ( ...
- 【Leetcode 338】 Counting Bits
问题描述:给出一个非负整数num,对[0, num]范围内每个数都计算它的二进制表示中1的个数 Example:For num = 5 you should return [0,1,1,2,1,2] ...