tkinter学习笔记_06
12、弹窗 messagebox
import tkinter as tk
from tkinter import messagebox
root = tk.Tk()
root.title("xxx")
root.geometry('200x100') def hit_me():
# tk.messagebox.showinfo(title='Hi', message='hahaha') # message 给窗口的信息,图标是python火箭
# tk.messagebox.showwarning(title='Hi', message='程序有错, 是否修改下执行') # 提示信息框 ,图标是感叹号
# tk.messagebox.showerror(title='Hi', message='程序错了不能再运行了')
# tk.messagebox.askquestion(title='Hi', message='yes or no') # 问用户信息,有返回值,返回值是yes和no
# if return == 'yes':
# print('xxxx')
# tk.messagebox.askyesno(title='Hi', message='yes or no') # 返回的是 False 和 True
print(tk.messagebox.askretrycancel(title='Hi', message='yes or no')) # 返回的是 重试True 和取消False
print(tk.messagebox.askokcancel(title='Hi', message='yes or no')) # 第一次返回的是 重试True 和取消False
# 第二次返回的是 确定True 和取消False
tk.Button(root, text='hit me', command=hit_me).pack() root.mainloop()
13、放置位置 pack grid place
import tkinter as tk
root = tk.Tk()
root.title("xxx")
root.geometry('200x100')
# pack方法
# tk.Label(root, text=1).pack(side='top') # 上
# tk.Label(root, text=1).pack(side='bottom') # 下
# tk.Label(root, text=1).pack(side='left') # 左
# tk.Label(root, text=1).pack(side='right') # 右 # grid方法12格子方法, 4行, 3列
# for i in range(4):
# for j in range(3):
# # row 行 column 列 padx 长 pady 高
# tk.Label(root, text=1).grid(row=i, column=j, padx=10, pady=10) # palce 精准放置
tk.Label(root, text=1).place(x=10, y=100, anchor='nw') # anchor 放在哪个角部 root.mainloop()
tkinter学习笔记_06的更多相关文章
- Python:GUI之tkinter学习笔记1控件的介绍及使用
相关内容: tkinter的使用 1.模块的导入 2.使用 3.控件介绍 Tk Button Label Frame Toplevel Menu Menubutton Canvas Entry Mes ...
- Python Tkinter学习笔记
介绍 入门实例 显示一个窗口,窗口里面有一个标签,显示文字 import tkinter as tk # 一个顶层窗口的实例(Top Level),也称为根窗口 app = tk.Tk() # 设置窗 ...
- Python:GUI之tkinter学习笔记之messagebox、filedialog
相关内容: messagebox 介绍 使用 filedialog 介绍 使用 首发时间:2018-03-04 22:18 messagebox: 介绍:messagebox是tkinter中的消息框 ...
- Python:GUI之tkinter学习笔记3事件绑定
相关内容: command bind protocol 首发时间:2018-03-04 19:26 command: command是控件中的一个参数,如果使得command=函数,那么点击控件的时候 ...
- Python:GUI之tkinter学习笔记2界面布局显示
相关内容: pack 介绍 常用参数 使用情况 常用函数 grid 介绍 常用参数 使用情况 常用函数 place 介绍 常用参数 使用情况 常用函数 首发时间:2018-03-04 14:20 pa ...
- tkinter学习笔记_04
8.勾选项 checkbutton import tkinter as tk root = tk.Tk() root.title("xxx") root.geometry('200 ...
- tkinter学习笔记_03
6.单选框 Radiobutton import tkinter as tk root = tk.Tk() root.title("xxx") root.geometry('2 ...
- tkinter学习笔记_05
10.菜单 menuber import tkinter as tk root = tk.Tk() root.title("xxx") root.geometry('200x100 ...
- Python GUI tkinter 学习笔记(三)
草稿 # -*- coding: utf-8 -*- from Tkinter import * root = Tk() Label(root, text = "First").g ...
随机推荐
- IDEA中用mybatis插件生成逆向工程
目录 maven项目 在resources目录下新建generatorConfig.xml文件 在resources目录下新建config.properties文件 运行 maven项目 <?x ...
- JavaScript对象及面向对象
1.创建对象(1)自定义对象 语法:var 对象名称=new Object();(2)内置对象 String(字符串)对象. Date(对象)对象 Array(数组)对象 Boll ...
- Android中如何动态添加碎片
Android中的开发需要兼容手机和平板,两个方面.这就引入了碎片的概念.(注意:这里用的Fragment强烈建议使用support-v4库中的Fragment) 碎片:是一种可以嵌入在活动当中的UI ...
- el-table里面的列需要对比两个返回参数
需求是这样的--- 已发布时间超过30分钟,显示黄色,超过一个钟显示红色 现在后台返回的时间的格式是2018-10-22 11:23:23的格式 做法是: 第一步: 先将后台返回的格式转化为时间戳,然 ...
- session与cookie之间的关系
一.客户端与服务端请求响应的关系 USER(客户端) 请求 tomcat(服务器), 属于HTTP请求.http请求是无状态的,即每次服务端接收到客户端的请求时,都是一个全新的请求,服务器并不知道客户 ...
- 每天有300W的pv,我们单台机器的QPS为58,大概需要部署几台这样机器?
每天有300W的pv,我们单台机器的QPS为58,大概需要部署几台这样机器? 一.总结 一句话总结: ( 3000000 * 0.8 ) / (86400 * 0.2 ) = 139 (QPS) 13 ...
- ingress nginx https配置
3.https配置第一步:制作自签证书 [root@master demo]# openssl genrsa -out tls.key 2048 [root@master demo]# openssl ...
- [转]vue项目中 指令 v-html 中使用过滤器filters功能
转载于简书 链接:http://www.jianshu.com/p/29b7eaabd1ba 问题 2.0 filters only work in mustache tags and v-bind. ...
- centos7 docker swarm加入集群失败
提示的错误为 [root@localhost downloads]# docker swarm join --token SWMTKN-1-2ezr0k5ybds1la4vgi2z7j8ykxkmm0 ...
- python2中的unicode()函数在python3中会报错:
python2中的unicode()函数在python3中会报错:NameError: name 'unicode' is not defined There is no such name in P ...