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 ...
随机推荐
- Apache配置php redis扩展
1.根据phpinfo,下载redis 下载地址:注意php版本号 http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/ http://wi ...
- HDU 数位dp
模板http://www.cnblogs.com/jffifa/archive/2012/08/17/2644847.html 完全理解以后,我发现这种写法实在是太厉害了,简洁,优美,可以回避很多细节 ...
- 一名十年Java程序员回忆阿里面试经历——揭开阿里面试的“遮羞布”
阿里面试经历 去阿里面试可以说非常非常的偶然和戏剧性,因为本人根本没投简历,以至于阿里hr给我电话的时候我一度认为是诈骗电话.因为深圳这家公司不错我还想在这里干个两年左右再考虑考虑. 这个时候的本人已 ...
- 什么是URL,URI或URN?
什么是URI? 每个Web服务器资源都有一个名字,这样客户端就可以说明它们感兴趣的资源是什么了. 服务器资源名被称为统一资源标识符(Uniform Resource Identifier, URI). ...
- 用python验证蒙提霍尔问题
最初看到这个问题是初中的时候买了一本有关数学谜题的书里面概率论的一张的课后拓展就是说到三门问题,当时作为一个扩展阅读看了一下,里面说到了一个世界智商最高的女人秒杀了美国一大群的数学高材生的精彩故事(比 ...
- BZOJ4550: 小奇的博弈(NIMK博弈& 组合数& DP)
4550: 小奇的博弈 Time Limit: 2 Sec Memory Limit: 256 MBSubmit: 159 Solved: 104[Submit][Status][Discuss] ...
- LeetCode Best Time to Buy and Sell Stock with Transaction Fee
原题链接在这里:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/descripti ...
- gradle 插件
1. 系统内置插件的应用 a. 二进制 apply plugin :"pluginname" 比如: java b. 脚本插件 apply from : "version ...
- <>这个符号表示泛型的意思
<>这个符号表示泛型的意思,泛型不是类而是类的模版 为什么是模版 这就与这个T有关了,如List<T> 这个T只是一个占位符,可以代表任意类型如 List<string& ...
- async/await的一些用法
普通函数 string Func() { string x = X(); string y = Y(); string z = Z(); return x + y + z; } X(), Y(), Z ...